deal with old-style classes in issubclass and isinstance

This commit is contained in:
Benjamin Peterson 2009-05-16 22:30:48 +00:00
parent fb6fb062e8
commit 94eaba78b7
1 changed files with 2 additions and 2 deletions

View File

@ -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 &&