Repository navigation
Conversation
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.
This prototype adds
?.attribute access to CPython 3.15.0.user?.profile?.namechecks each operand forNone, skips the remaining attributes/calls/subscripts when a check fails, and evaluates each operand once. Other falsy values and ordinary exceptions retain their behavior; parentheses end the chain.Every checked access now compiles to a dedicated stack-preserving
JUMP_IF_NONE, with noCOPY, temporary local or restriction to the first 16 local slots. ItsJUMP_IF_NOT_NONEinverse supports CFG normalization. The change integrates instrumented branch events, branch-history caches, tier-two guards and reference analysis, and regenerates opcode/interpreter metadata and the frozen-main fixture. The fork's.pycmagic number changes from 3666 to 3667 because opcode numbering changes. It includes 38 feature tests and semantics/build/benchmark documentation inDoc/none-aware-prototype.md.The branch starts at upstream
v3.15.0(d220409a13b77de7a6c30abe16ea90db01528edc). This PR targets the fork's3.15branch;mainremains for upstream synchronization. This is a draft syntax experiment, not an upstream submission or a merge/deployment request.?[...],?(),??and??=remain outside scope; IDEs, formatters and type checkers do not yet understand the new syntax.Validation on macOS arm64:
./python.exe -E -Wd -m test -j8 -u all --timeout=900 --rerun --slowest, exit 0,FAILURE then SUCCESS. 53,158 test cases across all 558 test files; 478 files passed, 78 skipped and two resource-denied (test_xpickle,test_zipfile64); 2,607 skipped cases. The initial frozen-main failure was fixed by regenerating its stale bytecode fixture; two initial Tkinter failures passed automatic targeted rerun. Duration 14m16s. This was not a clean first-pass result.--enable-experimental-jit=interpreter:test_none_aware test_capi.test_opt test_monitoring test_sys_settrace -j2 --timeout=600passed all four files: 890 cases, four skips. The mixed-chain test verifies actual executors contain the new stack-preserving guards.ruff check --fix --unsafe-fixes --previewpass on the changed tests. Configured mypy checks pass onTools/cases_generator(19 files) andTools/build(12 files).-O3, no PGO/LTO: 51 shuffled rounds, one million calls per sample. Final medians (?./ explicit, ns per call): attribute/None 15.52/15.70; attribute/object 32.71/35.89; chain/None 15.50/16.36; chain/missing profile 34.00/38.63; chain/full object 48.96/51.95. These five microbenchmarks show no measured penalty against explicit checks; they do not establish universal zero overhead or whole-application speedups. Full methodology and comparison with the original COPY-based prototype are documented.Native JIT machine-code generation, free-threaded builds and Linux/Windows remain unvalidated. The earlier 785 passing FinCtrl tests apply to the original prototype and were not repeated for the new opcode. Changes subsequently added to the target branch have not been tested together with this pinned 3.15.0 experiment.