Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c89db64

Browse files
committed
Fix RecursionError when closing nbAgg figures.
Previously, if a figure number was not in the list of managed figures, the destroy would be skipped, but now that only happens if a figure number is passed. If a figure manager is passed, then the destroy happens regardless. In nbAgg, this loops around closing/close_event and eventually calls destroy again, leading to a RecursionError.
1 parent 98dff87 commit c89db64

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/_pylab_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ def destroy(cls, num):
5757
manager = num
5858
if cls.figs.get(manager.num) is manager:
5959
cls.figs.pop(manager.num)
60+
else:
61+
return
6062
else:
6163
try:
6264
manager = cls.figs.pop(num)

0 commit comments

Comments
 (0)