Skip to content

gh-118513: Fix sibling comprehensions with a name bound in one and global in the other #118526

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

Merged
merged 4 commits into from
May 3, 2024

Conversation

carljm
Copy link
Member

@carljm carljm commented May 2, 2024

The handling of a name with one scope outside the comprehension and another inside it was missing the case where a name is implicit-global inside the comprehension, but becomes a local outside the comprehension due to another inlined comprehension in the same scope which binds the name. Cover this case as well.

@carljm carljm added the needs backport to 3.12 only security fixes label May 2, 2024
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks! I have several questions :)

@carljm
Copy link
Member Author

carljm commented May 3, 2024

Thanks for the reviews! I've addressed all comments, enabling auto-merge.

@carljm carljm enabled auto-merge (squash) May 3, 2024 13:43
@carljm carljm merged commit c8deb1e into python:main May 3, 2024
36 checks passed
@miss-islington-app
Copy link

Thanks @carljm for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 3, 2024
…and global in the other (pythonGH-118526)

(cherry picked from commit c8deb1e)

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
@bedevere-app
Copy link

bedevere-app bot commented May 3, 2024

GH-118548 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label May 3, 2024
carljm added a commit that referenced this pull request May 3, 2024
… and global in the other (GH-118526) (#118548)

gh-118513: Fix sibling comprehensions with a name bound in one and global in the other (GH-118526)
(cherry picked from commit c8deb1e)

Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
SonicField pushed a commit to SonicField/cpython that referenced this pull request May 8, 2024
…and global in the other (python#118526)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
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.

4 participants