Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
GH-127682: Only call__iter__ once in generator expressions.#132351
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
d87e7f3 intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry,@markshannon, I could not cleanly backport this to |
Fidget-Spinner commentedApr 11, 2025
Do you need to bump the magic number here? I forgot if compiler-only changes need that. |
brandtbucher commentedApr 11, 2025
I don’t think so, since the bytecode format and behavior is unchanged. |
| >>> list(g) | ||
| [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] | ||
| Verify that the outermost for-expression makes an immediate check |
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.
This is a regression.
Yhg1s commentedJun 5, 2025
If this change of behaviour is actually desirable (which may require some further discussion to establish), it should be mentioned in the What's New documentation. |
markshannon commentedJun 5, 2025
See#135171 (comment) for a more detailed analysis I'll make a PR for the what's new |
Uh oh!
There was an error while loading.Please reload this page.
Removes the extra
GET_ITERinstruction emitted when creating a generator expression.This:
__iter__method to be used in generator expressions, as they were up until 3.12.