Repository navigation
Align AST construction and replacement with Python 3.15 - #9272
Merged
youknowone merged 1 commit intoOct 22, 2026
Merged
Conversation
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 2
✨ Finishing Touches
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 |
Validate missing-field metadata, recognize exact generic aliases for list field defaults, and preserve surrogate names in ordered constructor errors. Route generated AST replacement methods through the shared argument handler. Extract the native closure from the 3.15 integration without parser/schema changes or new library copies. Existing canonical tests remain unchanged. Assisted-by: OpenAI Codex:model-version-unavailable
youknowdot
force-pushed
the
split/ast-construction-315
branch
from
October 21, 2026 16:14
ca913bb to
2e1b9bf
Compare
youknowone
marked this pull request as ready for review
October 22, 2026 02:18
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. |
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
Extract the native AST construction/replacement closure from #8954 onto current main, without parser, PEP 798, schema or library changes.
_field_typeswhen constructor fields remain, while keeping fully supplied and fieldless custom nodes valid.GenericAliasinstances, matching CPython.__replace__methods through the existing shared argument handler, including its positional-argument diagnostic.Only
_ast/python.rsand_ast/pyast.rschange. Existing canonical test bodies, assertions and expected-failure markers are untouched; no duplicate snippets or Python-behavior Rust tests are added. This does not depend on Ruff #7.Verification
Source reviewed against CPython 3.15.0 at
d220409a13b77de7a6c30abe16ea90db01528edc.Linux rebuilds of both main
cf56c1faand the candidate ran the same 22 selected canonical constructor/replacement methods separately: 20 passed and the same two existing expected failures remained. The corresponding 22 methods passed on pinned CPython. These selections are regression guards, not direct proof of the specific semantic changes.Eight bounded external observations, using ordinary Python objects, compared exact baseline/candidate/oracle outcomes, messages and codepoints. The candidate fixes the observed
GenericAliassubclass, surrogate-name and positional-replacement differences exactly; four controls remain unchanged. A non-dict_field_typesnow raisesSystemErrorrather than succeeding. Its message deliberately omits CPython's implementation-specificObjects/dictobject.c:2620:prefix, so exact-message parity is not claimed for that case.The exact candidate also passed threading and no-threading VM library checks, workspace and separately configured CAPI test compilation (
--no-run), both strict all-target Clippy gates (-D warnings), and the configured applicable hooks. Workspace gates exclude wasm, venvlauncher and the separately checked CAPI. All 3,631 tracked source/symlink entries matched the recorded candidate manifest after validation. Build caches were reused; no clean-cache build is claimed.Validation is bounded. No full AST/native suite, recursive-copy stress, broad pickle sweep, malformed-bytes crash-prevention case, no-threading runtime or non-Linux validation is claimed. Tests used one Cargo job, no incremental compilation, process limits and time/resource guards. No runtime guard fired.
Integration note
#8944 changes these AST files for interpreter-local class architecture. This extraction does not duplicate that work, but its method-registration hunks may need textual reconciliation if that PR lands later.
AI assistance
Prepared, extracted, source-reviewed and validated with OpenAI Codex (model version unavailable), for maintainer-requested Python 3.15 upgrade work. Validation described above is automated; no human manual-use verification is claimed.