GeezerVison is showing github.com — Make inner oparg values private by ShaharNaveh · Pull Request #7050 · RustPython/RustPython
Conversation
ShaharNaveh
commented
Feb 8, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
Refactor
- Standardized bytecode instruction argument handling and conversion patterns for improved code consistency and maintainability across the compiler's internal architecture.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Feb 8, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 Walkthrough
Walkthrough
This pull request refactors the OpArg and OpArgByte bytecode argument types by encapsulating their inner fields (making them private), introducing standardized public constructors (new and NULL constant), and updating all usage sites across the codebase to use the new API patterns. The changes affect code generation, bytecode instruction handling, and VM runtime layers without altering functional behavior.
Changes
| Cohort / File(s) |
Summary |
ByteCode Core API crates/compiler-core/src/bytecode/oparg.rs |
Encapsulated OpArg and OpArgByte fields (private), introduced pub const fn new() constructors and NULL constants, updated From trait implementations to use new() instead of direct construction. |
Bytecode Instruction Layer crates/compiler-core/src/bytecode/instruction.rs |
Updated Arg<T> constructor and conversion methods to use OpArg::new() and explicit u32::from() conversions instead of accessing private fields directly. |
Code Generation crates/codegen/src/compile.rs, crates/codegen/src/ir.rs |
Updated OpArg construction patterns across instruction emission and IR to use OpArg::new() and OpArg::NULL; replaced OpArg::null() calls and direct field access with new constructors. |
VM Runtime crates/vm/src/frame.rs |
Updated yield value handling to use explicit u8::from() conversion instead of direct field access for OpArg argument extraction. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
🐰 Hop, skip, and refactor with glee!
OpArg's fields now hidden, can't see—
With new() and NULL in place,
Constructors shine with encapsulated grace,
Bytecode arguments dance wild and free! ✨
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title 'Make inner oparg values private' is fully related to the main change, which refactors OpArg and OpArgByte by making their inner fields private and introducing new constructors and constants. |
| Docstring Coverage |
✅ Passed |
Docstring coverage is 96.15% which is sufficient. The required threshold is 80.00%. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
No actionable comments were generated in the recent review. 🎉
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.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|