GeezerVison is showing github.com — Reorder PyNumberBinaryOp to match NB_* constants by youknowone · Pull Request #7512 · RustPython/RustPython
Conversation
youknowone
commented
Mar 27, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Align variant ordering with BinaryOperator enum and CPython's NB_* constants from opcode.h. Divmod is placed last as it has no corresponding NB_* constant.
Summary by CodeRabbit
- Chores
- Internal code reorganization to align with Python conventions. No user-facing changes.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Align variant ordering with BinaryOperator enum and
CPython's NB_* constants from opcode.h. Divmod is placed
last as it has no corresponding NB_* constant.
coderabbitai
Bot
commented
Mar 27, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: 9f24d04b-66eb-42b1-8b0c-fac239474a3c
📥 Commits
Reviewing files that changed from the base of the PR and between 9282a87 and 5c80cee.
📒 Files selected for processing (1)
crates/vm/src/protocol/number.rs
📝 Walkthrough
Walkthrough
Reorders variants in the PyNumberBinaryOp enum to align with the NB_* constants ordering from opcode.h. This is a structural reorganization of enum variant sequence without functional changes to existing methods.
Changes
| Cohort / File(s) |
Summary |
Enum Variant Reordering crates/vm/src/protocol/number.rs |
Reordered PyNumberBinaryOp enum variants including Add, Subtract, Multiply, Remainder, And, FloorDivide, Lshift, MatrixMultiply, Or, Rshift, TrueDivide, Xor, Divmod and their corresponding Inplace* variants to match NB_* constants ordering from opcode.h. No functional changes to methods. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~3 minutes
Possibly related PRs
- Unify BINARY_OP bytecodes #6317: Directly related enum variant reordering to align operator discriminants with unified NB_* and bytecode-level BinaryOp ordering.
Poem
🐰 Hop, hop! The operators dance in line,
Now sorted like opcode.h does design,
No logic bent, just variants rearranged,
Order brings harmony, all has changed! 📋✨
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
⚠️ Warning |
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name |
Status |
Explanation |
| Description Check |
✅ Passed |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
✅ Passed |
The title accurately summarizes the main change: reordering the PyNumberBinaryOp enum to match NB_* constants from opcode.h, which is the primary objective of the pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
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.
youknowone
added a commit
that referenced
this pull request
Sep 16, 2026
Align variant ordering with BinaryOperator enum and
CPython's NB_* constants from opcode.h. Divmod is placed
last as it has no corresponding NB_* constant.
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.
|