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

Skip to content

Commit 1ef5768

Browse files
authored
Merge pull request #16321 from meeseeksmachine/auto-backport-of-pr-16311-on-v3.2.x
Backport PR #16311 on branch v3.2.x (don't override non-Python signal handlers)
2 parents 6353165 + 444838e commit 1ef5768

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
@@ -1042,9 +1042,11 @@ def trigger_manager_draw(manager):
10421042
def mainloop():
10431043
old_signal = signal.getsignal(signal.SIGINT)
10441044
# allow SIGINT exceptions to close the plot window.
1045-
signal.signal(signal.SIGINT, signal.SIG_DFL)
1045+
if old_signal:
1046+
signal.signal(signal.SIGINT, signal.SIG_DFL)
10461047
try:
10471048
qApp.exec_()
10481049
finally:
10491050
# reset the SIGINT exception handler
1050-
signal.signal(signal.SIGINT, old_signal)
1051+
if old_signal:
1052+
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)