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

Appearance settings

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

Open
ZeroIntensity wants to merge 16 commits into
python:mainpython/cpython:mainfrom
ZeroIntensity:subinterpreter-signalsZeroIntensity/cpython:subinterpreter-signalsCopy head branch name to clipboard
Open

gh-137173: Allow signal handling in isolated subinterpreters#137174
ZeroIntensity wants to merge 16 commits into
python:mainpython/cpython:mainfrom
ZeroIntensity:subinterpreter-signalsZeroIntensity/cpython:subinterpreter-signalsCopy head branch name to clipboard

Conversation

@ZeroIntensity

@ZeroIntensity ZeroIntensity commented Jul 28, 2025

Copy link
Copy Markdown
Member

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

neonene commented Jul 30, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review stale Stale PR or inactive for long period of time. topic-subinterpreters

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.