diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-10-04 21:55:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 21:55:57 (GMT) |
commit | 9ece9cd65cdeb0a1f6e60475bbd0219161c348ac (patch) | |
tree | 0ed869df28102785bfbb38ae7178aac48c1672bb /Objects/abstract.c | |
parent | 619f98045d73859688e5cfdb946d183e6d493a64 (diff) | |
download | cpython-9ece9cd65cdeb0a1f6e60475bbd0219161c348ac.zip cpython-9ece9cd65cdeb0a1f6e60475bbd0219161c348ac.tar.gz cpython-9ece9cd65cdeb0a1f6e60475bbd0219161c348ac.tar.bz2 |
bpo-41909: Enable previously disabled recursion checks. (GH-22536)
Enable recursion checks which were disabled when get __bases__ of
non-type objects in issubclass() and isinstance() and when intern
strings. It fixes a stack overflow when getting __bases__ leads
to infinite recursion.
Originally recursion checks was disabled for PyDict_GetItem() which
silences all errors including the one raised in case of detected
recursion and can return incorrect result. But now the code uses
PyDict_GetItemWithError() and PyDict_SetDefault() instead.
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index c471f18..c30fb4e 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2336,9 +2336,7 @@ abstract_get_bases(PyObject *cls) _Py_IDENTIFIER(__bases__); PyObject *bases; - Py_ALLOW_RECURSION (void)_PyObject_LookupAttrId(cls, &PyId___bases__, &bases); - Py_END_ALLOW_RECURSION if (bases != NULL && !PyTuple_Check(bases)) { Py_DECREF(bases); return NULL; |