8000 Merge pull request #16356 from meeseeksmachine/auto-backport-of-pr-16… · matplotlib/matplotlib@37163f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37163f6

Browse files
authored
Merge pull request #16356 from meeseeksmachine/auto-backport-of-pr-16330-on-v3.1.x
Backport PR #16330 on branch v3.1.x (Clearer signal handling)
2 parents f98a87e + a01ca17 commit 37163f6

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
@@ -1092,11 +1092,12 @@ def trigger_manager_draw(manager):
10921092
def mainloop():
10931093
old_signal = signal.getsignal(signal.SIGINT)
10941094
# allow SIGINT exceptions to close the plot window.
1095-
if old_signal:
1095+
is_python_signal_handler = old_signal is not None
1096+
if is_python_signal_handler:
10961097
signal.signal(signal.SIGINT, signal.SIG_DFL)
10971098
try:
10981099
qApp.exec_()
10991100
finally:
11001101
# reset the SIGINT exception handler
1101-
if old_signal:
1102+
if is_python_signal_handler:
11021103
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)
0