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

Skip to content

Commit ef12195

Browse files
authored
don't override non-Python signal handlers
1 parent af4ab53 commit ef12195

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ def trigger_manager_draw(manager):
10341034
def mainloop():
10351035
old_signal = signal.getsignal(signal.SIGINT)
10361036
# allow SIGINT exceptions to close the plot window.
1037-
signal.signal(signal.SIGINT, signal.SIG_DFL)
1037+
if old_signal: signal.signal(signal.SIGINT, signal.SIG_DFL)
10381038
try:
10391039
qApp.exec_()
10401040
finally:
10411041
# reset the SIGINT exception handler
1042-
signal.signal(signal.SIGINT, old_signal)
1042+
if old_signal: signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)