Add __replace__ and fix __reduce__ for structseq#6978
Add __replace__ and fix __reduce__ for structseq#6978youknowone merged 2 commits intoRustPython:mainfrom
Conversation
- Add __replace__ method to PyStructSequence trait - Move __reduce__ from #[pymethod] to extend_pyclass with contains_key guard, allowing per-type overrides - Fix repr: remove trailing comma for single-field sequences
📝 WalkthroughWalkthroughThis change adds a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Code has been automatically formatted The code in this PR has been formatted using:
git pull origin structseq |
__replace__method to PyStructSequence trait__reduce__from #[pymethod] to extend_pyclass with contains_key guard, allowing per-type overridesSummary by CodeRabbit
New Features
__replace__method for struct sequences, enabling creation of modified copies by replacing selected fields via keyword arguments.__reduce__method handling.Bug Fixes