Skip to content

Commit de3b78e

Browse files
authored
Fix: always clear _draw_called
1 parent 170a075 commit de3b78e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

matplotlib_inline/backend_inline.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,20 @@ def flush_figures():
115115
if not show._draw_called:
116116
return
117117

118-
if InlineBackend.instance().close_figures:
119-
# ignore the tracking, just draw and close all figures
120-
try:
121-
return show(True)
122-
except Exception as e:
123-
# safely show traceback if in IPython, else raise
124-
ip = get_ipython()
125-
if ip is None:
126-
raise e
127-
else:
128-
ip.showtraceback()
129-
return
130118
try:
119+
if InlineBackend.instance().close_figures:
120+
# ignore the tracking, just draw and close all figures
121+
try:
122+
return show(True)
123+
except Exception as e:
124+
# safely show traceback if in IPython, else raise
125+
ip = get_ipython()
126+
if ip is None:
127+
raise e
128+
else:
129+
ip.showtraceback()
130+
return
131+
131132
# exclude any figures that were closed:
132133
active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()])
133134
for fig in [fig for fig in show._to_draw if fig in active]:

0 commit comments

Comments
 (0)