-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-30570: Use Py_EnterRecursiveCall() in issubclass() #29048
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <[email protected]>
GH-29175 is a backport of this pull request to the 3.10 branch. |
* Use Py_EnterRecursiveCall() in issubclass() Reviewed-by: Gregory P. Smith <[email protected]> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <[email protected]>
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 <[email protected]> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <[email protected]>
|
…-29178) * Use Py_EnterRecursiveCall() in issubclass() Reviewed-by: Gregory P. Smith <[email protected]> [Google] (cherry picked from commit 423fa1c) Co-authored-by: Dennis Sweeney <[email protected]>
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