Skip to content

Commit 51c4b5f

Browse files
committed
Clarify behavior for non-specializing operators
1 parent 6c6b78f commit 51c4b5f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/specialize.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,9 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
14211421
}
14221422
break;
14231423
default:
1424+
// These operators don't have any available specializations. Rather
1425+
// than repeatedly attempting to specialize them, just convert them
1426+
// back to BINARY_OP (while still recording a failure, of course)!
14241427
*instr = _Py_MAKECODEUNIT(BINARY_OP, adaptive->original_oparg);
14251428
}
14261429
SPECIALIZATION_FAIL(BINARY_OP, SPEC_FAIL_OTHER);
@@ -1431,4 +1434,4 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
14311434
success:
14321435
STAT_INC(BINARY_OP, specialization_success);
14331436
adaptive->counter = initial_counter_value();
1434-
}
1437+
}

0 commit comments

Comments
 (0)