bpo-30570: Use Py_EnterRecursiveCall() in issubclass()#29048
bpo-30570: Use Py_EnterRecursiveCall() in issubclass()#29048gpshead merged 3 commits intopython:mainpython/cpython:mainfrom sweeneyde:issubclass_recursionsweeneyde/cpython:issubclass_recursionCopy head branch name to clipboard
Conversation
gpshead
left a comment
There was a problem hiding this comment.
I added another test case (the specific example from the bug). Yours likely already covers it, just wanted it for pedantic reasons. I like this. Much nicer than mine. I was unaware of our new EnterRecursiveCall API pair. perfect! :)
|
Thanks @sweeneyde for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10. |
* Use Py_EnterRecursiveCall() in issubclass() Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
|
GH-29175 is a backport of this pull request to the 3.10 branch. |
|
Thanks @sweeneyde for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
|
GH-29178 is a backport of this pull request to the 3.9 branch. |
* Use Py_EnterRecursiveCall() in issubclass() Reviewed-by: Gregory P. Smith <greg@krypto.org> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
|
This is an alternative to GH-29017. This shouldn't affect performance too much because the recursion checks only occur once for each time a length>=2
__bases__tuple is found (i.e. for multiple inheritance). Note that if we get stuck in thewhile (1) {...}loop, as long as the pathological__bases__implementation is in Python, we can still interrupt with a KeyboardInterrupt.https://bugs.python.org/issue30570