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 — Make inner oparg values private by ShaharNaveh · Pull Request #7050 · RustPython/RustPython

Conversation

@ShaharNaveh

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

Uh oh!

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

Copy link
Copy Markdown
Contributor

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.

All reactions
@ShaharNaveh
Make inner oparg values private
b2e20ba
@ShaharNaveh
ShaharNaveh marked this pull request as ready for review February 8, 2026 12:38
@coderabbitai

coderabbitai Bot commented Feb 8, 2026 •
edited
Loading

Uh oh!

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

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

  • Make OpArgType::from_op_arg to return a Result<Self, MarshalError> #6914 — Modifies the same Arg<T>/OpArg construction and conversion paths in instruction.rs and oparg.rs
  • Move OpArg to its own file #6703 — Reworks OpArg/OpArgByte constructors, visibility, and Arg<T> conversion patterns in the same files
  • Bytecode oparg optimization #7032 — Updates bytecode oparg implementation with OpArg constructors and conversion logic

Suggested reviewers

  • youknowone

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 docstrings
🧪 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
  • 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 8, 2026
View reviewed changes
@youknowone
youknowone enabled auto-merge (squash) February 8, 2026 14:36
@youknowone
youknowone merged commit ea352cc into RustPython:main Feb 8, 2026
23 of 24 checks passed

Uh oh!

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

@coderabbitai coderabbitai Bot mentioned this pull request Mar 5, 2026
Newtype ConstIdx, Constants #7358
Merged
youknowone pushed a commit that referenced this pull request Sep 16, 2026
@ShaharNaveh
Make inner oparg values private (#7050)
b034742
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.