diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 8 | ||||
-rw-r--r-- | Objects/classobject.c | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 47d2f31..8389774 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2021,11 +2021,11 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls) int i; int n = PyTuple_GET_SIZE(cls); for (i = 0; i < n; ++i) { - if (!check_class(PyTuple_GET_ITEM(cls, i), - "issubclass() arg 2 must be a class" - " or tuple of classes")) - return -1; + retval = PyObject_IsSubclass(derived, PyTuple_GET_ITEM(cls, i)); + if (retval != 0) /* either found it, or got an error */ + return retval; } + return 0; } else { if (!check_class(cls, diff --git a/Objects/classobject.c b/Objects/classobject.c index f3b9873..5234a65 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -490,9 +490,10 @@ PyClass_IsSubclass(PyObject *class, PyObject *base) if (PyTuple_Check(base)) { n = PyTuple_GET_SIZE(base); for (i = 0; i < n; i++) { - if (class == PyTuple_GET_ITEM(base, i)) + if (PyClass_IsSubclass(class, PyTuple_GET_ITEM(base, i))) return 1; } + return 0; } if (class == NULL || !PyClass_Check(class)) return 0; |