mirror of
https://github.com/RustPython/RustPython.git
synced 2026-06-02 19:39:49 +09:00
Reorder PyNumberBinaryOp to match NB_* constants (#7512)
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.
This commit is contained in:
@@ -200,33 +200,34 @@ impl PyNumberMethods {
|
||||
}
|
||||
}
|
||||
|
||||
/// Matches the NB_* constants ordering from opcode.h / BinaryOperator.
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum PyNumberBinaryOp {
|
||||
Add,
|
||||
Subtract,
|
||||
And,
|
||||
FloorDivide,
|
||||
Lshift,
|
||||
MatrixMultiply,
|
||||
Multiply,
|
||||
Remainder,
|
||||
Divmod,
|
||||
Lshift,
|
||||
Rshift,
|
||||
And,
|
||||
Xor,
|
||||
Or,
|
||||
Rshift,
|
||||
Subtract,
|
||||
TrueDivide,
|
||||
Xor,
|
||||
InplaceAdd,
|
||||
InplaceSubtract,
|
||||
InplaceAnd,
|
||||
InplaceFloorDivide,
|
||||
InplaceLshift,
|
||||
InplaceMatrixMultiply,
|
||||
InplaceMultiply,
|
||||
InplaceRemainder,
|
||||
InplaceLshift,
|
||||
InplaceRshift,
|
||||
InplaceAnd,
|
||||
InplaceXor,
|
||||
InplaceOr,
|
||||
FloorDivide,
|
||||
TrueDivide,
|
||||
InplaceFloorDivide,
|
||||
InplaceRshift,
|
||||
InplaceSubtract,
|
||||
InplaceTrueDivide,
|
||||
MatrixMultiply,
|
||||
InplaceMatrixMultiply,
|
||||
InplaceXor,
|
||||
Divmod,
|
||||
}
|
||||
|
||||
impl PyNumberBinaryOp {
|
||||
|
||||
Reference in New Issue
Block a user