Skip to content

Clearer signal handling #16330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,11 +1034,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)