aboutsummaryrefslogtreecommitdiff
path: root/Python/specialize.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index cfc21bf70a..dd15de72d2 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1424,6 +1424,19 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
goto success;
}
break;
+ case NB_SUBTRACT:
+ case NB_INPLACE_SUBTRACT:
+ if (PyLong_CheckExact(lhs)) {
+ *instr = _Py_MAKECODEUNIT(BINARY_OP_SUBTRACT_INT,
+ _Py_OPARG(*instr));
+ goto success;
+ }
+ if (PyFloat_CheckExact(lhs)) {
+ *instr = _Py_MAKECODEUNIT(BINARY_OP_SUBTRACT_FLOAT,
+ _Py_OPARG(*instr));
+ goto success;
+ }
+ break;
default:
// These operators don't have any available specializations. Rather
// than repeatedly attempting to specialize them, just convert them