GeezerVison is showing github.com — Newtype `LoadSuperAttr` oparg by ShaharNaveh · Pull Request #7002 · RustPython/RustPython
Conversation
ShaharNaveh
commented
Feb 5, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
If this will be merged I'll do the same for LoadAttr opcode
Summary by CodeRabbit
- Refactor
- Refactored super attribute loading mechanism to use a structured builder-based approach instead of low-level encoding calls.
- Enhanced bytecode argument handling with improved type safety for super attribute operations.
- Reorganized public API exports to support the new structured argument type handling.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Feb 5, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
📝 Walkthrough
Walkthrough
The changes refactor super-attribute loading instruction handling by replacing low-level u32 encoding/decoding with a typed LoadSuperAttr struct using a builder pattern. This spans compiler codegen, bytecode definitions, and VM execution, removing old encode/decode helper functions and introducing a strongly-typed oparg representation.
Changes
| Cohort / File(s) |
Summary |
Oparg Type Definition crates/compiler-core/src/bytecode/oparg.rs |
Introduces new public LoadSuperAttr struct with three bit-field accessors (name_idx, is_load_method, has_class), a builder pattern via LoadSuperAttrBuilder, and trait implementations for OpArgType conversion and u32 interop. |
Instruction Type Updates crates/compiler-core/src/bytecode/instruction.rs |
Changes LoadSuperAttr variant argument type from Arg to Arg, removes encode_load_super_attr_arg and decode_load_super_attr_arg functions, and updates display/serialization to use typed accessors. |
Bytecode Exports crates/compiler-core/src/bytecode.rs |
Removes instruction re-exports for encode/decode_load_super_attr_arg and encode/decode_load_attr_arg; adds LoadSuperAttr to oparg public exports. |
Codegen Integration crates/codegen/src/compile.rs |
Replaces four emit helpers (emit_load_super_attr, emit_load_super_method, emit_load_zero_super_attr, emit_load_zero_super_method) to construct LoadSuperAttr via builder instead of calling encode_load_super_attr_arg; imports LoadSuperAttr in public module. |
VM Execution crates/vm/src/frame.rs |
Updates load_super_attr method signature to accept oparg: LoadSuperAttr instead of oparg: u32; refactors argument extraction to use LoadSuperAttr accessor methods (name_idx(), is_load_method(), has_class()). |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~22 minutes
Possibly related PRs
Suggested reviewers
Poem
🐰 A builder so clean, no encode in sight,
LoadSuperAttr shines with typed delight!
From u32's murk to fields so bright,
Super attributes now structured just right. ✨
🚥 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 'Newtype LoadSuperAttr oparg' accurately summarizes the main change: introducing a newtype wrapper for the LoadSuperAttr opcode argument, which is reflected across all modified files. |
| Docstring Coverage |
✅ Passed |
Docstring coverage is 95.65% 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|