Repository navigation
Fix os.closerange and immediate process exit - #9006
Merged
youknowone merged 2 commits intoOct 8, 2026
Merged
Conversation
Close raw descriptor numbers through the host CRT layer rather than constructing OwnedFd values for possibly closed descriptors. Preserve the half-open range, ignored close errors and Windows invalid-parameter handling. Assisted-by: Codex:model-version-unavailable
Python os._exit, failed child exec and fatal/watchdog exits must bypass C exit handlers. Call the host CRT _exit on Unix, Windows and WASI while retaining the existing non-host fallback. Normal interpreter termination is unchanged. Assisted-by: Codex:model-version-unavailable
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
youknowone
approved these changes
Oct 8, 2026
youknowone
marked this pull request as ready for review
October 8, 2026 15:12
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.
Summary
Split the portable descriptor/termination fixes out of #8954 for the current Python 3.14 main branch.
os.closerange, ignoring close errors as required. A range can contain already-closed descriptors and cannot safely be represented byOwnedFdvalues._exitfor Pythonos._exit, failed child exec, the fatal-signal fallback, and faulthandler'sexit=Truewatchdog. Ordinary interpreter shutdown and the non-host fallback are unchanged.The diff is four Rust files, with no canonical test, workflow, dependency, or profile changes.
Validation
Independently tested on the main-based commit, rather than reusing the mega-PR results:
test_oscloserange cases, fullFileTests,test_atexit, and three canonical child-failure cases passed. Existing platform/implementation skips are unchanged.os._exit(0/37)and watchdogexit=Truedo neither. Failed child exec avoids inherited C exit handlers while the parent still cleans up normally. This passed in dev and release builds.Full local
test_oswas not run because the sandbox denies its asyncio AF_UNIX socketpair. The unchanged hosted tests remain enabled. Local execution was Linux only; cross-platform CI is pending.AI assistance
Codex assisted with implementation, extraction, source review, and validation. Both commits retain their
Assisted-bydisclosure trailers.