Skip to content

Commit 89b6c37

Browse files
committed
set oparg, check *descr
1 parent 2b4c610 commit 89b6c37

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Python/specialize.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,16 @@ binary_op_extended_specialization(PyObject *lhs, PyObject *rhs, int oparg,
25772577
if (ret < 0) {
25782578
return -1;
25792579
}
2580-
2580+
if (ret == 1) {
2581+
if (*descr == NULL) {
2582+
PyErr_Format(
2583+
PyExc_ValueError,
2584+
"tp_binop_specialize of '%.200s' returned 1 with *descr == NULL",
2585+
Py_TYPE(lhs)->tp_name);
2586+
return -1;
2587+
}
2588+
(*descr)->oparg = oparg;
2589+
}
25812590
return ret;
25822591
}
25832592
return 0;

0 commit comments

Comments
 (0)