[Python-checkins] bpo-45697: Use PyObject_TypeCheck in type_call (GH-29392)

serhiy-storchaka webhook-mailer at python.org
Thu Nov 4 06:40:22 EDT 2021

commit: 2c045bd5673d56c3fdde7536da9df1c7d6f270f0
branch: main
author: Itamar Ostricher <itamarost at gmail.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2021-11-04T12:39:50+02:00

bpo-45697: Use PyObject_TypeCheck in type_call (GH-29392)

M Objects/typeobject.c

diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 18bea476ea9f2..51ec93d875271 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1121,7 +1121,7 @@ type_call(PyTypeObject *type, PyObject *args, PyObject *kwds)
     /* If the returned object is not an instance of type,
        it won't be initialized. */
-    if (!PyType_IsSubtype(Py_TYPE(obj), type))
+    if (!PyObject_TypeCheck(obj, type))
         return obj;
     type = Py_TYPE(obj);

More information about the Python-checkins mailing list