Skip to content

Commit d65af21

Browse files
authored
Clearer signal handling (#16330)
Clearer signal handling
2 parents ae5fd1d + cd5d0b6 commit d65af21

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
@@ -1035,11 +1035,12 @@ def trigger_manager_draw(manager):
10351035
def mainloop():
10361036
old_signal = signal.getsignal(signal.SIGINT)
10371037
# allow SIGINT exceptions to close the plot window.
1038-
if old_signal:
1038+
is_python_signal_handler = old_signal is not None
1039+
if is_python_signal_handler:
10391040
signal.signal(signal.SIGINT, signal.SIG_DFL)
10401041
try:
10411042
qApp.exec_()
10421043
finally:
10431044
# reset the SIGINT exception handler
1044-
if old_signal:
1045+
if is_python_signal_handler:
10451046
signal.signal(signal.SIGINT, old_signal)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy