◐ Shell
clean mode source ↗

Reorder PyNumberBinaryOp to match NB_* constants by youknowone · Pull Request #7512 · RustPython/RustPython

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.