Skip to content

Commit 788e9c2

Browse files
committed
Ternary ops (currently only pow/ipow) don't use __r*__ dunders
1 parent 3a7a4c4 commit 788e9c2

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

Objects/abstract.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name)
10121012
Calling scheme used for ternary operations:
10131013
10141014
Order operations are tried until either a valid result or error:
1015-
v.op(v,w,z), w.op(v,w,z), z.op(v,w,z)
1015+
v.op(v,w,z), w.op(v,w,z)
10161016
*/
10171017

10181018
static PyObject *
@@ -1071,22 +1071,6 @@ ternary_op(PyObject *v,
10711071
Py_DECREF(x); /* can't do it */
10721072
}
10731073

1074-
PyNumberMethods *mz = Py_TYPE(z)->tp_as_number;
1075-
if (mz != NULL) {
1076-
ternaryfunc slotz = NB_TERNOP(mz, op_slot);
1077-
if (slotz == slotv || slotz == slotw) {
1078-
slotz = NULL;
1079-
}
1080-
if (slotz) {
1081-
PyObject *x = slotz(v, w, z);
1082-
assert(_Py_CheckSlotResult(z, op_name, x != NULL));
1083-
if (x != Py_NotImplemented) {
1084-
return x;
1085-
}
1086-
Py_DECREF(x); /* can't do it */
1087-
}
1088-
}
1089-
10901074
if (z == Py_None) {
10911075
PyErr_Format(
10921076
PyExc_TypeError,

0 commit comments

Comments
 (0)