bpo-41909: Enable previously disabled recursion checks.#22536
Conversation
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.
4e60463 to
5b1438e
Compare
gvanrossum
left a comment
There was a problem hiding this comment.
Can we now get rid of the Py_ALLOW_RECURSION macro? It is undocumented and I find it unlikely that anyone outside the core would be using it (I tried to search GitHub but only found many, many forks of CPython...).
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9. |
|
Sorry @serhiy-storchaka, I had trouble checking out the |
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
|
Sure, but in a separate PR. |
…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. (cherry picked from commit 9ece9cd) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-22550 is a backport of this pull request to the 3.9 branch. |
…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.. (cherry picked from commit 9ece9cd) Co-authored-by: Serhiy Storchaka <[email protected]>
|
GH-22551 is a backport of this pull request to the 3.8 branch. |
…) (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 9ece9cd)
…) (GH-22551) 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 9ece9cd)
|
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.
Enable recursion checks which were disabled when get
__bases__ofnon-type objects in
issubclass()andisinstance()and when internstrings. It fixes a stack overflow when getting
__bases__leadsto infinite recursion.
Originally recursion checks was disabled for
PyDict_GetItem()whichsilences all errors including the one raised in case of detected
recursion and can return incorrect result. But now the code uses
PyDict_GetItemWithError()andPyDict_SetDefault()instead.https://bugs.python.org/issue41909