Repository navigation
Conversation
shaury04
force-pushed
the
gh-134075-checksignals-guide
branch
from
October 16, 2026 19:31
c956d33 to
c6f2373
Compare
Documentation build overview
|
|
|
||
| .. _extending-interruptible: | ||
|
|
||
| Making long-running operations interruptible |
Member
There was a problem hiding this comment.
@zackw This PR seems to be AI-generated, but is this what you were looking for?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Long-running C extensions can delay Ctrl-C handling until they return to the
interpreter. Add a guide explaining where to call
PyErr_CheckSignals(), how topropagate exceptions and clean up partial results, and how to keep extension
state safe when signal handlers execute arbitrary Python code.
Include a C example that processes immutable input in chunks, reattaches the
thread state before checking signals, and discards its private output on error.
Cover free-threaded builds, checking frequency, blocking library calls, and
main-thread signal handling. Link to the guide from the C API reference and
make the attached-thread-state requirement explicit there.
Fixes #134075.
Validation
--nitpicky --fail-on-warningand no warnings.the strict full-tree build to exit nonzero, as expected by the docs CI workflow;
all three checks in
Doc/tools/check-warnings.pypass against the repository'swarning baseline.
sphinx-lint --enable=default-rolepasses for both changed files.-Wall -Wextra -Werror(unused parametersexcluded) and passes five tests on CPython 3.13.7: chunk boundaries and contents,
invalid input, KeyboardInterrupt, preservation of custom exceptions, and a
returning handler that re-enters the extension. The interruption tests verify
that the C function returns NULL, rather than allowing deferred delivery after
a successful return. The standalone validation harness is supplied with the
review artifacts, outside the documentation-only patch.
git diff --checkpasses.AI assistance was used to draft the documentation and validate the example.