Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
don't override non-Python signal handlers#16311
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
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.
conditional on style fix and ci passing.
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free tosuggest an improvement. |
The 2.2.x branch does not have the restoring logic, rather than implicitly backport that as well, only push this back to 3.1.x |
Thanks@stevengj ! Congratulations on your first merged Matplotlib pull request 🎉 Hopefully we will hear from you again. |
…311-on-v3.1.xBackport PR#16311 on branch v3.1.x (don't override non-Python signal handlers)
…311-on-v3.2.xBackport PR#16311 on branch v3.2.x (don't override non-Python signal handlers)
timjim333 commentedJan 25, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi, I had a similar issue that only appeared when I ran Matplolib fromParaview's pvpython - is this fix something that I can implement or do I have to wait for the next release on conda? Thanks and regards. Tim Edit: I just applied the 2-line fix detailed in the link at the top of the page manually in my conda-managed file: I'm not sure if this is the best idea or not, but it fixes the issue for the moment! |
timjim333 commentedJan 25, 2020
Sorry, just to add an additional comment (I know you've already sent off the patch) - would it be a little more robust to check |
From my understanding of the Python docs, any valid signal handler will have a True truth value. |
Uh oh!
There was an error while loading.Please reload this page.
The qt5 backend's
mainloop()
function (used by the non-interactiveshow()
) callssignal(SIGINT, SIG_DFL)
to temporarily override theSIGINT
handler while the plot window is open. Unfortunately, this fails when Python has been embedded in another program and a non-Python signal handler is installed, as we encountered in Julia atJuliaPy/PyPlot.jl#459.In particular, when
signal.getsignal(SIGINT)
returnsNone
, this isdocumented to mean that "the previous signal handler was not installed from Python." In this case, you should not override the signal handler because there is no way to restore it — thesignal(SIGINT, old_signal)
function throws aTypeError
ifold_signal
isNone
.The fix is simple: don't try to override the
SIGINT
handler ifold_signal
isNone
.