Skip to content

Commit 81d5a24

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 45243eb commit 81d5a24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/backends/backend_qt5agg.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66

77
from matplotlib.externals import six
88

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

1213
from matplotlib.figure import Figure
1314

@@ -178,6 +179,9 @@ def __draw_idle_agg(self, *args):
178179
try:
179180
FigureCanvasAgg.draw(self)
180181
self.update()
182+
except Exception:
183+
# Uncaught exceptions are fatal for PyQt5, so catch them instead.
184+
traceback.print_exc()
181185
finally:
182186
self._agg_draw_pending = False
183187

0 commit comments

Comments
 (0)