Skip to content

Commit 859a660

Browse files
Merge pull request matplotlib#31778 from QuLogic/qt-timer-shutdown
Qt: Silence an exception at interpreter exit
2 parents 25644ce + d813588 commit 859a660

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/matplotlib/backends/backend_qt.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,13 @@ def __init__(self, *args, **kwargs):
195195
super().__init__(*args, **kwargs)
196196

197197
def __del__(self):
198-
self._timer_stop()
198+
try:
199+
self._timer_stop()
200+
except RuntimeError as e:
201+
# Silence warning on shutdown.
202+
ignore_msg = "wrapped C/C++ object of type QTimer has been deleted"
203+
if str(e) != ignore_msg:
204+
raise
199205

200206
def _timer_set_single_shot(self):
201207
self._timer.setSingleShot(self._single)

0 commit comments

Comments
 (0)