From 94eaba78b738309180381b9cb44efceca48c53ff Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 16 May 2009 22:30:48 +0000 Subject: [PATCH] deal with old-style classes in issubclass and isinstance --- Objects/abstract.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c index 5fb7bfc01e1..2266fa16279 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2927,7 +2927,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls) return r; } - if (PyInstance_Check(cls)) { + if (PyClass_Check(cls) || PyInstance_Check(cls)) { checker = PyObject_GetAttrString(cls, "__instancecheck__"); if (checker == NULL) { if (PyErr_ExceptionMatches(PyExc_AttributeError)) @@ -3013,7 +3013,7 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls) Py_LeaveRecursiveCall(); return r; } - if (PyInstance_Check(cls)) { + if (PyClass_Check(cls) || PyInstance_Check(cls)) { PyErr_Fetch(&t, &v, &tb); checker = PyObject_GetAttr(cls, name); if (checker == NULL &&