Skip to content

Commit 5105aef

Browse files
committed
bpo-45967: Use PyObject_TypeCheck in type_call and binary_op1
1 parent acc89db commit 5105aef

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/abstract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ binary_op1(PyObject *v, PyObject *w, const int op_slot
881881

882882
if (slotv) {
883883
PyObject *x;
884-
if (slotw && PyType_IsSubtype(Py_TYPE(w), Py_TYPE(v))) {
884+
if (slotw && PyObject_TypeCheck(w, Py_TYPE(v))) {
885885
x = slotw(v, w);
886886
if (x != Py_NotImplemented)
887887
return x;

Objects/typeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1121,7 +1121,7 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds)
11211121

11221122
/* If the returned object is not an instance of type,
11231123
it won't be initialized. */
1124-
if (!PyType_IsSubtype(Py_TYPE(obj), type))
1124+
if (!PyObject_TypeCheck(obj, type))
11251125
return obj;
11261126

11271127
type = Py_TYPE(obj);

0 commit comments

Comments
 (0)