10000 Backport PR #16311: don't override non-Python signal handlers · matplotlib/matplotlib@df0e01e · GitHub
[go: up one dir, main page]

Skip to content

Commit df0e01e

Browse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #16311: don't override non-Python signal handlers
1 parent d10aacf commit df0e01e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,11 @@ def trigger_manager_draw(manager):
10911091
def mainloop():
10921092
old_signal = signal.getsignal(signal.SIGINT)
10931093
# allow SIGINT exceptions to close the plot window.
1094-
signal.signal(signal.SIGINT, signal.SIG_DFL)
1094+
if old_signal:
1095+
signal.signal(signal.SIGINT, signal.SIG_DFL)
10951096
try:
10961097
qApp.exec_()
10971098
finally:
10981099
# reset the SIGINT exception handler
1099-
signal.signal(signal.SIGINT, old_signal)
1100+
if old_signal:
1101+
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)
0