◐ Shell
clean mode source ↗

Upgrade test_code and fix code bugs by youknowone · Pull Request #7440 · RustPython/RustPython

CPython Developers and others added 3 commits

March 16, 2026 15:25
- Add Comparable and Hashable traits for PyCode
- Compare by name, args, flags, bytecode, consts, names, vars, linetable
- Hash by tuple of key attributes matching CPython's code_hash
- Remove unused custom_ops slice in Instruction::try_from
- Add co_lnotab intentional non-implementation comment

coderabbitai[bot]

- Add CO_NESTED flag (0x10) for nested function scopes
- Emit LOAD_SMALL_INT for integers 0..=255 instead of LOAD_CONST
- Eliminate dead constant expression statements (no side effects)
- Ensure None in co_consts for functions with no other constants
- Add code.__replace__() for copy.replace() support
- Mark test_co_lnotab and test_invalid_bytecode as expectedFailure

coderabbitai[bot]

youknowone added a commit to youknowone/RustPython that referenced this pull request

Mar 22, 2026
Upgrade test_code and fix code bugs