Rebase range iterator `__reduce__` to match CPython (#8424) · sthagen/RustPython-RustPython@c420cc5 · GitHub
Skip to content

Commit c420cc5

Browse files
devyubinyouknowone
andauthored
Rebase range iterator __reduce__ to match CPython (RustPython#8424)
* Rebase range iterator __reduce__ to match CPython range_iterator.__reduce__ (and longrange_iterator) returned the original range plus the current index as pickle state; CPython returns the range rebased to the current position with a None state. Rebase start by index * step (clamped to the length) and emit None. __setstate__ is kept so pickles carrying an integer state still load. Assisted-by: Claude Code:claude-opus-4-8 * Add snippet test for range iterator __reduce__ Assert the rebased range and None state added in the previous commit. The snippet runner executes it under both CPython and RustPython, so it also cross-checks the representation against CPython. Assisted-by: Claude Code:claude-opus-4-8 * Update extra_tests/snippets/builtin_range.py --------- Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
1 parent 6079ad0 commit c420cc5

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

crates/vm/src/builtins/range.rs

Lines changed: 5 additions & 1 deletion

extra_tests/snippets/builtin_range.py

Lines changed: 11 additions & 0 deletions

0 commit comments

Comments
 (0)