summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorDennis Sweeney <36520290+sweeneyde@users.noreply.github.com>2021-10-22 21:24:08 (GMT)
committerGitHub <noreply@github.com>2021-10-22 21:24:08 (GMT)
commit423fa1c1817abfa8c3d1bc308ddbbd8f28b69d68 (patch)
tree416e4d37e4761b89012aa7dd001a923182081f67 /Objects
parentf6e8b80d20159596cf641305bad3a833bedd2f4f (diff)
downloadcpython-423fa1c1817abfa8c3d1bc308ddbbd8f28b69d68.zip
cpython-423fa1c1817abfa8c3d1bc308ddbbd8f28b69d68.tar.gz
cpython-423fa1c1817abfa8c3d1bc308ddbbd8f28b69d68.tar.bz2
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() (GH-29048)
* Use Py_EnterRecursiveCall() in issubclass() Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google]
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 6f7b946..6227ad5 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2557,14 +2557,22 @@ abstract_issubclass(PyObject *derived, PyObject *cls)
derived = PyTuple_GET_ITEM(bases, 0);
continue;
}
- for (i = 0; i < n; i++) {
- r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls);
- if (r != 0)
- break;
- }
+ break;
+ }
+ assert(n >= 2);
+ if (Py_EnterRecursiveCall(" in __issubclass__")) {
Py_DECREF(bases);
- return r;
+ return -1;
}
+ for (i = 0; i < n; i++) {
+ r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls);
+ if (r != 0) {
+ break;
+ }
+ }
+ Py_LeaveRecursiveCall();
+ Py_DECREF(bases);
+ return r;
}
static int