From 2964320169db8c52fed6cd4ebf6457f2cf2b8d08 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 28 Jan 2020 17:54:04 +0100 Subject: [PATCH] Backport PR #16330: Clearer signal handling --- lib/matplotlib/backends/backend_qt5.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index ee15bfbf369d..b2bd2d564a39 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -1043,11 +1043,12 @@ def trigger_manager_draw(manager): def mainloop(): old_signal = signal.getsignal(signal.SIGINT) # allow SIGINT exceptions to close the plot window. - if old_signal: + is_python_signal_handler = old_signal is not None + if is_python_signal_handler: signal.signal(signal.SIGINT, signal.SIG_DFL) try: qApp.exec_() finally: # reset the SIGINT exception handler - if old_signal: + if is_python_signal_handler: signal.signal(signal.SIGINT, old_signal) 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