Skip to content

gh-137173: Allow signal handling in isolated subinterpreters #137174

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented Jul 28, 2025

Add PyInterpreterConfig.can_handle_signals to make it possible for a subinterpreter to handle signals when it's running on the main thread. All interpreters created by concurrent.interpreters now include signal handling by default.


📚 Documentation preview 📚: https://cpython-previews--137174.org.readthedocs.build/

@brettcannon brettcannon removed their request for review July 28, 2025 18:55
@neonene
Copy link
Contributor

neonene commented Jul 30, 2025

Please update Doc/library/signal.rst and Modules/signalmodule.c as well, which are mainly related to #19087.

Catching signals while another interpreter has registered `signal`
module handlers still does not work, because we don't have a good way to
make the callbacks per-interpreter. We'd need something like PEP 788's
weak reference API to safely keep references to interpreters without
worrying about concurrent deallocation during signal handling.
@ZeroIntensity
Copy link
Member Author

Please update Doc/library/signal.rst and Modules/signalmodule.c as well, which are mainly related to #19087.

Updated. Note that there are still some bugs with signal here; it isn't really possible to safely have per-interpreter callbacks without PEP 788's weak references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants