Repository navigation
Sync remaining Python 3.15.2 test isolation helpers and coverage - #9911
youknowone merged 3 commits into
Conversation
Use update_lib to synchronize subprocess options, environment and timeout handling, related canonical support tests, and SQLite DBM input coverage. Preserve RustPython-specific support adaptations. Part of RustPython#9852. Assisted-by: OpenAI Codex:GPT-6.1
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters: 1
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 70ecedcf42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| finally: | ||
| try: | ||
| os.unlink(self._result_path) |
There was a problem hiding this comment.
Restore worker cleanup when waiting is interrupted
If the waiting parent receives KeyboardInterrupt while the worker ignores or does not receive SIGINT, or if tick() raises, this finally block only deletes the result file: the worker remains running and its captured pipes remain open. The previous subprocess.run() path killed the worker on exceptions, so interrupting a long-running isolated test now leaks a process that can continue consuming memory and CPU. Add exceptional-exit cleanup to terminate and reap the worker and close its pipes.
Useful? React with 👍 / 👎.
| self._proc.kill() | ||
| stdout, stderr = self._proc.communicate() |
There was a problem hiding this comment.
Bound output collection after killing a timed-out test
On POSIX, if the isolated test spawns a descendant that inherits stdout/stderr, killing the test process leaves the descendant's copies of those pipe handles open. The subsequent unbounded communicate() waits for EOF until that descendant exits, so runInSubprocess(timeout=...) can still hang indefinitely instead of reporting the timeout. Keep post-kill output collection bounded, or terminate the subprocess group, before raising the timeout error.
Useful? React with 👍 / 👎.
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] test: cpython/Lib/test/test_free_threading (TODO: 1) dependencies: dependent tests: (no tests depend on free_threading) [x] lib: cpython/Lib/ssl.py dependencies:
dependent tests: (57 tests)
[ ] lib: cpython/Lib/test/support dependencies:
dependent tests: (2 tests)
[x] lib: cpython/Lib/dbm dependencies:
dependent tests: (5 tests)
Legend:
|
Move reap_threads from the test class to its three test methods, matching canonical CPython 3.15.2. The upgraded helper deliberately rejects class decorators. Preserve all assertions and thread cleanup; do not weaken the helper. Assisted-by: OpenAI Codex:GPT-6.1
Head branch was pushed to by a user without write access
Reap the direct worker when a tick or parent wait is interrupted. Capture output in temporary files so inherited descendant handles cannot hold timeout reporting open. Snapshot without altering the shared writer offset, with delete-sharing independent readers on Windows. This intentionally fixes two defects also present in canonical CPython 3.15.2. Process groups and test assertions remain unchanged. Windows runtime validation remains pending hosted CI. Assisted-by: OpenAI Codex:GPT-6.1
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e0405e351
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| (3.14, b"3.14"), | ||
| ("string", b"string"), | ||
| (b"bytes", b"bytes"), | ||
| (True, b"1"), |
There was a problem hiding this comment.
Revert non-marker edits to CPython test data
These added cases directly modify test data, and the same patch makes further non-marker test-logic changes under Lib/test. The repository's critical policy permits only adding or removing RustPython failure markers in CPython test files and explicitly forbids test logic or data edits, so these changes must not be landed directly.
AGENTS.md reference: AGENTS.md:L76-L81
Useful? React with 👍 / 👎.
| if os.path.exists(f"/dev/fd/{dirfd}"): | ||
| names = list(os.scandir(dirfd)) | ||
| # Don't count dirfd | ||
| return len(names) - 1 |
There was a problem hiding this comment.
Exclude scandir's duplicate fd from the count
When /proc/self/fd is unavailable on FreeBSD but fdescfs is mounted, RustPython's FdDirStream::from_fd() preserves dirfd by duplicating it, and fdescfs exposes both descriptors in this names list. Subtracting only one therefore makes fd_count() report one descriptor too many on this path; account for both helper descriptors or enumerate without creating the second one.
Useful? React with 👍 / 👎.
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
Part of #9852. Batch the remaining related Python-only test infrastructure updates through
scripts/update_lib:The imported files follow CPython 3.15.2, except the explicitly justified isolation-helper fixes below. The JSON free-threading test is also synchronized with canonical 3.15.2, moving thread cleanup from the class to its three methods to match the upgraded helper. Existing RustPython support/init.py and other adaptations remain untouched. No bespoke repository tests, Rust changes or newly introduced skips/xfails.
Validation
testin isolated-mode paths; not a full reference pass. SQLite DBM reference passed.Remaining work
This does not close #9852. Canonical re LOCALE-negated-set, ssize-minimum format width and zlib negative combine-length tests exposed native failures and were left out for separate fixes, rather than marking them expected failures in this Python-only batch. Existing deliberate RustPython adaptations and deferred CAPI tests also require explicit accounting before the tracker can close.
AI-assisted by OpenAI Codex (GPT-6.1).
Review follow-up: worker lifecycle and inherited output
Both review findings also reproduce in the unmodified CPython 3.15.2 helper. A raising tick/KeyboardInterrupt left its worker alive; a 0.3-second timeout waited 2.45 seconds for a descendant holding inherited stdout/stderr pipes.
The helper now kills and reaps its direct worker on interrupted waits and captures output in temporary files. It waits only for that worker and snapshots a bounded file extent, never waiting for descendant pipe EOF. POSIX positional reads and an independent Windows delete-sharing/binary reader avoid changing the shared writer offset. Files and the result path are cleaned up. No process-group/session change or descendant termination is introduced.
This is an intentional upstream divergence: captured output is now a regular file (including seekability/fstat behavior), and output written later by surviving descendants is best-effort rather than awaited. Windows temporary-file deletion is deferred by the OS while inherited handles remain open.
Validation after this change: