mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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.
This commit is contained in:
parent
619f98045d
commit
9ece9cd65c
4 changed files with 12 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue