summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-12-12 19:14:08 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-12-12 19:14:08 (GMT)
commit7e5c6a02eba1a6f5e93bfa1241ceff39bec9f3c9 (patch)
tree503cd8986a6ced722156e1e4eda5accd6e8bc9e8 /Objects/abstract.c
parent1b3b49d1325475bc54743125ee5e519c62fc45f1 (diff)
downloadcpython-7e5c6a02eba1a6f5e93bfa1241ceff39bec9f3c9.zip
cpython-7e5c6a02eba1a6f5e93bfa1241ceff39bec9f3c9.tar.gz
cpython-7e5c6a02eba1a6f5e93bfa1241ceff39bec9f3c9.tar.bz2
Change issubclass() so that recursive tuples (directly or indirectly
containing class objects) are allowed as the second argument. This makes issubclass() more similar to isinstance() where recursive tuples are allowed too.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c8
1 files changed, 4 insertions, 4 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,