Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
user202729 wants to merge 1 commit into matplotlib:main
base: main
Choose a base branch
Loading
from user202729:handler

Conversation

Copy link

@user202729 user202729 commented Apr 18, 2025
edited
Loading

Previously, cysignals signal handlers are broken after plt.pause() is called. More explanation can be found in sagemath/sage#39601 and sagemath/cysignals#228

The change was adapted from prompt-toolkit/python-prompt-toolkit#1822

PR checklist

Copy link

@github-actions github-actions bot left a 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.

Copy link
Member

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).

user202729 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /