GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Newtype `LoadSuperAttr` oparg by ShaharNaveh · Pull Request #7002 · RustPython/RustPython

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Feb 5, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@ShaharNaveh
Newtype LoadSuperAttr oparg
778776d
@coderabbitai

coderabbitai Bot commented Feb 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
📝 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

  • Bytecode instrumented placeholder #6741 — Introduces LoadSuperAttr instruction variants and modifies the Instruction enum in lockstep with this refactor.
  • Super instructions #6694 — Earlier modifications to the super-attribute loading pipeline (encode/decode helpers and pseudo-opcodes) that are now being replaced by this typed approach.
  • Align psuedo ops to CPython 3.14.2 #6846 — Adds encode_load_super_attr_arg helpers and emission functions that this PR refactors into the builder pattern.

Suggested reviewers

  • youknowone

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 docstrings
🧪 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

youknowone
youknowone approved these changes Feb 5, 2026
View reviewed changes

@youknowone youknowone left a comment

Copy link
Copy Markdown
Member

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.

All reactions
@youknowone
youknowone merged commit 5b7db1d into RustPython:main Feb 5, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

youknowone pushed a commit that referenced this pull request Sep 16, 2026
@ShaharNaveh
Newtype LoadSuperAttr oparg (#7002)
57496bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@youknowone youknowone youknowone approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

2 participants

@ShaharNaveh @youknowone
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.