8000 Clearer signal handling · matplotlib/matplotlib@cd5d0b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd5d0b6

Browse files
committed
Clearer signal handling
1 parent 5d660a4 commit cd5d0b6
Copy full SHA for cd5d0b6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/matplotlib/backends/backend_qt5.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,11 +1034,12 @@ 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-
if old_signal:
1037+
is_python_signal_handler = old_signal is not None
1038+
if is_python_signal_handler:
10381039
signal.signal(signal.SIGINT, signal.SIG_DFL)
10391040
try:
10401041
qApp.exec_()
10411042
finally:
10421043
# reset the SIGINT exception handler
1043-
if old_signal:
1044+
if is_python_signal_handler:
10441045
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)
0