]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45697: Use PyObject_TypeCheck in type_call (GH-29392)
authorItamar Ostricher <itamarost@gmail.com>
Thu, 4 Nov 2021 10:39:50 +0000 (03:39 -0700)
committerGitHub <noreply@github.com>
Thu, 4 Nov 2021 10:39:50 +0000 (12:39 +0200)
Objects/typeobject.c

index 18bea476ea9f2576c07195733b477f492f9cd138..51ec93d875271a32f408870326ece3d3f3e1235f 100644 (file)
@@ -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);