From df0e01e031e2e4f238048257d90f94f8a469b374 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 24 Jan 2020 21:22:06 -0800 Subject: [PATCH] Backport PR #16311: don't override non-Python signal handlers --- lib/matplotlib/backends/backend_qt5.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_qt5.py b/lib/matplotlib/backends/backend_qt5.py index b36e6564287b..181dcb4843f7 100644 --- a/lib/matplotlib/backends/backend_qt5.py +++ b/lib/matplotlib/backends/backend_qt5.py @@ -1091,9 +1091,11 @@ def trigger_manager_draw(manager): def mainloop(): old_signal = signal.getsignal(signal.SIGINT) # allow SIGINT exceptions to close the plot window. - signal.signal(signal.SIGINT, signal.SIG_DFL) + if old_signal: + signal.signal(signal.SIGINT, signal.SIG_DFL) try: qApp.exec_() finally: # reset the SIGINT exception handler - signal.signal(signal.SIGINT, old_signal) + if old_signal: + 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