You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Align constant-table and nested code-object emission order in large modules #28
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.
Activity
Interleave const fold passes per-block to match CPython
youknowone commentedon May 16, 2026
Verified against the current local release build with
scripts/compare_bytecode.py.Evidence:
test/test_ast/snippets.py:1 match, 0 differtest/test_dis.py:1 match, 0 differThe constant-table / nested code-object ordering drift described here is no longer present in the representative files, so closing this as completed.
Interleave const fold passes per-block to match CPython
Bytecode parity - CFG reorders and LOAD_FAST_BORROW chain (#7870)
Bytecode parity - CFG reorders and LOAD_FAST_BORROW chain (#7870)