summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.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/classobject.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/classobject.c')
-rw-r--r--Objects/classobject.c3
1 files changed, 2 insertions, 1 deletions
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;