Summary
Some large remaining diffs are dominated by module-level constant layout and nested code-object ordering, not
only by local CFG issues.
Evidence
The clearest cases are:
Lib/test/test_ast/snippets.py: 1 code object, 4216 instruction diffs
Lib/test/test_dis.py: module-level drift plus smaller function-level drift
Representative mismatches include:
- CPython loading a large constant blob or nested code object from
co_consts
- RustPython loading a different constant earlier, or emitting nested code objects in a different order
- large
EXTENDED_ARG / constant-index layout divergence caused by different constant ordering
Expected direction
RustPython should match CPython’s ordering for:
- nested code object insertion
- large constant materialization
- constant-table population where it affects emitted bytecode
Likely implementation areas
crates/codegen/src/compile.rs
- code-object construction / constant collection order
Done when
test_ast/snippets.py and the module-level part of test_dis.py stop diverging as a single giant constant-
layout mismatch and instead match CPython’s constant ordering and nested code-object structure.
Summary
Some large remaining diffs are dominated by module-level constant layout and nested code-object ordering, not
only by local CFG issues.
Evidence
The clearest cases are:
Lib/test/test_ast/snippets.py: 1 code object, 4216 instruction diffsLib/test/test_dis.py: module-level drift plus smaller function-level driftRepresentative mismatches include:
co_constsEXTENDED_ARG/ constant-index layout divergence caused by different constant orderingExpected direction
RustPython should match CPython’s ordering for:
Likely implementation areas
crates/codegen/src/compile.rsDone when
test_ast/snippets.pyand the module-level part oftest_dis.pystop diverging as a single giant constant-layout mismatch and instead match CPython’s constant ordering and nested code-object structure.