-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Restore OS-level signal handler after changing it in plt.pause() #29947
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
Conversation
@github-actions
github-actions
bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Specifically https://github.com/python/cpython/blob/ce31ae5209c976d28d1c21fcbb06c0ae5e50a896/Modules/signalmodule.c#L535-L538 is the source of the problem as (somewhat reasonably) CPython unconditionally takes over the underlying signal handling machinery when you register a Python side signal handler (if CPython does not do that it can not call the user provided handler for the user.
Contrary to prompt-toolkit, we already have a fair amount of compiled code I would rather see a helper in https://github.com/matplotlib/matplotlib/blob/main/src/_c_internal_utils.cpp. This is both to avoid having ctypes in generally and because Python can be built without the ctypes module.
Signal handling is a fun rabbit hole that I was sure we had already gotten to the bottom of (when we added checking to making sure that handler set from julia didn't get broken).
Uh oh!
There was an error while loading. Please reload this page.
Previously,
cysignals
signal handlers are broken afterplt.pause()
is called. More explanation can be found in sagemath/sage#39601 and sagemath/cysignals#228The change was adapted from prompt-toolkit/python-prompt-toolkit#1822
PR checklist