Make OpArgType::from_op_arg to return a Result<Self, MarshalError>#6914
Make OpArgType::from_op_arg to return a Result<Self, MarshalError>#6914youknowone merged 1 commit into
OpArgType::from_op_arg to return a Result<Self, MarshalError>#6914Conversation
📝 WalkthroughWalkthroughA refactoring of error handling in bytecode instruction processing, converting return types from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
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 |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@crates/compiler-core/src/bytecode/oparg.rs`:
- Around line 640-645: from_op_arg for UnpackExArgs currently truncates high
bytes via to_le_bytes; instead validate that the upper two bytes of x are zero
before constructing UnpackExArgs to avoid accepting invalid bytecode: check (x
>> 16) == 0 (or inspect bytes[2..]) and return an appropriate MarshalError if
non-zero, otherwise proceed to extract before and after and return
Ok(Self{before, after}); reference UnpackExArgs, OpArgType::from_op_arg, and
MarshalError to locate where to add the check and error return.
Sorry, something went wrong.
988b8b8
into
RustPython:main
Jan 31, 2026
This will allow us to use
num_enumcrate with a custom error, I'll do it in a followup PRSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.