mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.9] bpo-41909: Enable previously disabled recursion checks. (GH-22536) (GH-22550)
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.
(cherry picked from commit 9ece9cd65c
)
This commit is contained in:
parent
f3a6b7fc0b
commit
7aa22ba923
4 changed files with 12 additions and 4 deletions
|
@ -15602,9 +15602,7 @@ PyUnicode_InternInPlace(PyObject **p)
|
|||
}
|
||||
|
||||
PyObject *t;
|
||||
Py_ALLOW_RECURSION
|
||||
t = PyDict_SetDefault(interned, s, s);
|
||||
Py_END_ALLOW_RECURSION
|
||||
|
||||
if (t == NULL) {
|
||||
PyErr_Clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue