Skip to content

Commit 3347d0f

Browse files
authored
Merge pull request ipython#17 from agoose77/patch-1
Fix: always clear `_draw_called`
2 parents f764b43 + de3b78e commit 3347d0f

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
@@ -119,19 +119,20 @@ def flush_figures():
119119
if not show._draw_called:
120120
return
121121

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

0 commit comments

Comments
 (0)