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

Skip to content

Commit 0c43f2a

Browse files
authored
Merge pull request #16357 from meeseeksmachine/auto-backport-of-pr-16330-on-v3.2.x
Backport PR #16330 on branch v3.2.x (Clearer signal handling)
2 parents 5b1be99 + 2964320 commit 0c43f2a

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
@@ -1043,11 +1043,12 @@ def trigger_manager_draw(manager):
10431043
def mainloop():
10441044
old_signal = signal.getsignal(signal.SIGINT)
10451045
# allow SIGINT exceptions to close the plot window.
1046-
if old_signal:
1046+
is_python_signal_handler = old_signal is not None
1047+
if is_python_signal_handler:
10471048
signal.signal(signal.SIGINT, signal.SIG_DFL)
10481049
try:
10491050
qApp.exec_()
10501051
finally:
10511052
# reset the SIGINT exception handler
1052-
if old_signal:
1053+
if is_python_signal_handler:
10531054
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)