Repository navigation
Sync canonical stdlib modules and offline stack formatting - #9315
Conversation
Migrate nine substantial stdlib and canonical test modules from CPython v3.15.0 through scripts/update_lib, preserving RustPython adaptations. Include offline stack formatting without live process inspection or changes to the held profiling frontend and test-support closure. Assisted-by: Codex:unknown
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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 |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [ ] lib: cpython/Lib/profiling dependencies:
dependent tests: (3 tests)
[x] lib: cpython/Lib/ctypes dependencies:
dependent tests: (37 tests)
[x] test: cpython/Lib/test/test_marshal.py (TODO: 3) dependencies: dependent tests: (32 tests)
[ ] lib: cpython/Lib/asyncio dependencies:
dependent tests: (8 tests)
[x] lib: cpython/Lib/_colorize.py dependencies:
dependent tests: (267 tests)
Legend:
|
Codex Review SummaryThis 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: 5963efcdcf
ℹ️ 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".
| from _colorize import get_theme | ||
| from _pyrepl.console import InteractiveColoredConsole as InteractiveConsole | ||
| except ModuleNotFoundError: | ||
| from code import InteractiveConsole |
There was a problem hiding this comment.
Define the failure sentinel for the basic-console fallback
When _pyrepl.console is unavailable and this fallback is selected, any evaluated statement that raises reaches AsyncIOInteractiveConsole.runcode(), which returns self.STATEMENT_FAILED; code.InteractiveConsole does not define that attribute (it exists only on InteractiveColoredConsole). The resulting AttributeError escapes the basic console's interact() loop and REPLThread stops the event loop, so the first normal user error terminates the fallback REPL. Define the sentinel on AsyncIOInteractiveConsole or avoid returning it on this path.
Useful? React with 👍 / 👎.
| ps.add_argument("pid", type=int, help="Process ID to inspect") | ||
| ps.add_argument( | ||
| "--retries", | ||
| type=int, |
There was a problem hiding this comment.
Reject negative retry counts before invoking the tools
When either new --retries option is given a negative integer (for example, ps 42 --retries -1), argparse accepts it because type=int; asyncio.tools._get_awaited_by_tasks() then iterates range(retries + 1) zero times and returns None, after which the table/tree builder raises TypeError and the CLI emits a traceback. The generated help advertises --retries RETRIES as “Number of retries on transient attach errors”, so use a non-negative parser validator while preserving 0 as one initial attempt.
Useful? React with 👍 / 👎.
| def _display_filename(filename): | ||
| if not filename or filename == "~": | ||
| return filename | ||
| with contextlib.suppress(ValueError): |
There was a problem hiding this comment.
Keep dumps working when the current directory is gone
When format_stack_dump() runs after the profiler's current directory has been removed, os.path.relpath() calls getcwd() and raises FileNotFoundError; this suppresses only ValueError, so filename prettification aborts the entire dump even though the original filename can still be emitted. Suppress OSError as well and fall back to filename.
Useful? React with 👍 / 👎.
Summary
Split nine coherent standard-library files from #8954 and synchronize them with CPython v3.15.0 (
d220409a13b77de7a6c30abe16ea90db01528edc) usingscripts/update_lib. Existing RustPython adaptations are preserved and independently replayed against canonical sources.--retriesCLI options; synchronize hostname and shutdown-race regressions.The existing native types/status constants needed by offline formatting are exported on main without Linux-only conditions. No new native capability or platform-skip adaptation is introduced.
Validation
Tested base:
0b0a3607648b5b01b3adfc1c06f3bec1d87f8a13.--help,ps --help,pstree --help). No PID command or interactive session was invoked.The runtime used an existing sealed main-base binary with only the unrelated #9303 AST-Single warning change, not an exact-main binary. Selected compilation and cases do not enter that changed route; relevant native source bindings were verified. No new native build or full workspace/CAPI suite was run. Local results are Linux-only; macOS/Windows execution remains for CI.
The separately guarded canonical loopback TLS shutdown-race case also passed, with no skip or expected failure. It used only two owned 127.0.0.1 server instances and repository test certificates; the pass does not prove the early-return race branch was taken.
AI assistance: Codex was used for source comparison, official-updater preparation, bounded validation and this description.