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

Skip to content

Commit c5cdc1a

Browse files
committed
Merge pull request #7052 from anntzer/catch-exceptions-in-qt5-draw-prevents-abort
FIX: Uncaught exns are fatal for PyQt5, so catch them.
1 parent 73a23f7 commit c5cdc1a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/backends/backend_qt5agg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
import six
88

9-
import sys
109
import ctypes
10+
import sys
11+
import traceback
1112

1213
from matplotlib.figure import Figure
1314

@@ -181,6 +182,9 @@ def __draw_idle_agg(self, *args):
181182
try:
182183
FigureCanvasAgg.draw(self)
183184
self.update()
185+
except Exception:
186+
# Uncaught exceptions are fatal for PyQt5, so catch them instead.
187+
traceback.print_exc()
184188
finally:
185189
self._agg_draw_pending = False
186190

0 commit comments

Comments
 (0)