FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression by iritkatriel · Pull Request #124394 · python/cpython · GitHub

/ cpython Public

gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression - #124394

Merged
iritkatriel merged 9 commits into
python:mainfrom
iritkatriel:pseudo-jumps
Sep 25, 2024
Merged

gh-124285: Fix bug where bool() is called multiple times for the same part of a boolean expression#124394
iritkatriel merged 9 commits into
python:mainfrom
iritkatriel:pseudo-jumps

Conversation

iritkatriel commented Sep 23, 2024
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

Comment thread Python/bytecodes.c Outdated

markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Very nice.
One suggestion for a comment, otherwise lgtm.

Copy link
Copy Markdown
Member

@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 a and b or c into (b or c) if a else c.

Copy link
Copy Markdown
Member Author

@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 a and b or c into (b or c) if a else c.

I'm not sure I see what the general solution is, but I'm all for trying it.

Copy link
Copy Markdown
Member Author

I'll merge this though - we can easily replace this with the alternative idea. The "sequence" pseudo-ops change is worth having anyway.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Behavior change for foo and 1 or 2: 3.12 newly converts foo to bool twice

3 participants


Back | FazBrowse Home | New Git URL