diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 18bea476ea9f25..6b0621fbe155fb 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1547,6 +1547,10 @@ PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) { PyObject *mro; + if (a == b) { + return 1; + } + mro = a->tp_mro; if (mro != NULL) { /* Deal with multiple inheritance without recursion