-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression #124394
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
…e same part of a boolean expression
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.
Very nice.
One suggestion for a comment, otherwise lgtm.
@ncoghlan on the issue suggested we could do this in the AST optimizer without changing the eval loop. Is that approach worth considering? It would involve transforming |
I'm not sure I see what the general solution is, but I'm all for trying it. |
I'll merge this though - we can easily replace this with the alternative idea. The "sequence" pseudo-ops change is worth having anyway. |
Fixes #124285.
foo and 1 or 2
: 3.12 newly convertsfoo
to bool twice #124285📚 Documentation preview 📚: https://cpython-previews--124394.org.readthedocs.build/