Repository navigation
Align compiler and VM bytecode contracts with CPython 3.15 - #9105
Conversation
Reconstruct the compiler-only baseline from validated487ae47 on the current main and frozen mapping prerequisitec78d811. Preserve the full source delta while dropping obsolete prerequisite ancestry; detailed old-to-new provenance is retained in the recovery artifact. Assisted-by: OpenAI Codex: model identifier unavailable
Replay reviewed compiler CI repairs 476bb74 on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure. Assisted-by: OpenAI Codex: model identifier unavailable
Replay reviewed compiler CI repairs 6482adf on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure. Assisted-by: OpenAI Codex: model identifier unavailable
Replay reviewed compiler CI repairs 246c309 on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure. Assisted-by: OpenAI Codex: model identifier unavailable
Replay reviewed compiler CI repairs 7ecedcf on the frozen current prerequisite. Intermediate compile/diagnostic corrections are combined where they address the same failure. Assisted-by: OpenAI Codex: model identifier unavailable
- Store co_consts, co_names, co_localsplusnames, co_localspluskinds, co_linetable, co_exceptiontable and co_name as objects on PyCode; build co_code and the varnames/cellvars/freevars tuples lazily in _co_cached, with co_code deoptimized through deopt_code. - Move the compiler constant cache (_PyCode_ConstantKey, const_cache_insert) to builtins/code/const_cache.rs. - Write every code field with w_object in marshal and pass the read field objects to MarshalBag::make_code through CodeFields. - Emit RETURN_GENERATOR/POP_TOP in enter_scope and place SETUP_CLEANUP after them; drop the generator part of insert_prefix_instructions. - Add PyCode::first_traceable (_co_firsttraceable) for _PyFrame_IsIncomplete and sys.monitoring. - Follow the CPython DISABLE branches in sys.monitoring, the check_matched signature in warnings, the 3.15 % format error messages for str and bytes, code_returns_only_none, and the FOR_ITER stack analysis. - Compute IMPORT_NAME flags with in_exception_handler. - Replace the linetable/exceptiontable byte tests in codegen with dis(show_positions=True) insta snapshots in _opcode. - Remove the opcode metadata verification tooling, byte-exact scripts, private cache tests and redundant snippets. - Restore test_code.py and test_monitoring.py to v3.15.0 plus RUSTPYTHON markers. Assisted-by: Claude Code:claude-opus-5-5
Drop extra_tests/snippets/generator_iterator_prefix.py. Its loop, delegation, async, f_back and never-awaited checks are covered by test_generators, test_coroutines, test_asyncgen, test_yield_from and test_monitoring. Move the remaining checks into existing files: genexpr prefix tracing and monitoring into stdlib_sys.py, and the caller frame seen from the eager iterator into stdlib_sys_getframe.py. Assisted-by: Claude Code:claude-opus-5-5
Module code compiled with PyCF_ALLOW_TOP_LEVEL_AWAIT and marked ste_coroutine now starts with RETURN_GENERATOR; POP_TOP. The prefix and RESUME emission move into emit_scope_prefix, shared by enter_scope and the module entry points, as in codegen_enter_scope. Fixes test_builtin.test_compile_top_level_await. Assisted-by: Claude Code:claude-opus-5-5
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. |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: :4: SyntaxWarning: invalid decimal literal dependencies:
dependent tests: (50 tests)
[x] test: cpython/Lib/test/test_generators.py dependencies: dependent tests: (no tests depend on generator) [ ] lib: cpython/Lib/code.py dependencies:
dependent tests: (2 tests) [x] test: cpython/Lib/test/test_compile.py dependencies: dependent tests: (no tests depend on compile) [x] lib: cpython/Lib/warnings.py dependencies:
dependent tests: (55 tests)
[x] test: cpython/Lib/test/test_monitoring.py (TODO: 4) dependencies: dependent tests: (no tests depend on monitoring) [x] lib: cpython/Lib/dis.py dependencies:
dependent tests: (80 tests)
[ ] test: cpython/Lib/test/test_format.py dependencies: dependent tests: (no tests depend on format) Legend:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
c_long is i32 on Windows, where clippy reports the cast to i32 as unnecessary. Assisted-by: Claude Code:claude-opus-5-5
pymath requires malachite-bigint ^0, so the example projects, which have no lock file, resolve it to 0.14.0 while the workspace pinned 0.13.0, and fail to build. Assisted-by: Claude Code:claude-opus-5-5
closes #9088
Replaces #9088, rebased onto main after #8951 and #9094 were merged. The PR author's commits are kept as they were; the commits from #9094 and the Windows manager CI diagnostic commits (which cancel each other out) are dropped.
Changes on top of #9088
enter_scopeand expose_co_firsttraceable. Line up monitoring DISABLE branches,check_matched, % format errors, and IMPORT_NAME flags with CPython (_PyCompile_InExceptionHandler).RETURN_GENERATOR; POP_TOPfor modules compiled withPyCF_ALLOW_TOP_LEVEL_AWAIT, matchingcodegen_enter_scope. This fixes the 3.15test_builtin.test_compile_top_level_awaitthat came in with Implement PEP 814 frozendict #8951.instadis snapshots.Lib/testfiles to v3.15.0 usingupdate_lib. The only edits areTODO: RUSTPYTHONmarkers.extra_tests/snippets/generator_iterator_prefix.py, which mostly duplicated test_generators, test_coroutines, test_asyncgen, test_yield_from and test_monitoring. The checks those modules don't cover (tracing and monitoring of the genexpr eager-iterator prefix, and the caller frame seen from it) moved intostdlib_sys.pyandstdlib_sys_getframe.py.Validation (local, macOS)
cargo fmt, clippy (workspace and capi),cargo test(workspace and capi) all pass.stdlib_mmapunder host CPython, andstdlib_sqlitebecause_sqlite3is missing) also fail without this PR.--dont-add-python-opts): onlytest_pyreplfails, and it fails the same way without this PR.test_builtinpasses after the top-level await fix.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
gi_stateproperty to report a generator’s current state.Bug Fixes