-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
UnboundLocalError when module is shadowed by a comprehension and then accessed by another comprehension #118513
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
Comments
cc @carljm |
Confirmed without a module too:
Disassembly shows we're using |
Thanks, taking a look. |
FYI, the assignment |
Yes, either way it should compile to |
…and global in the other
Fix in #118526 |
…obal in the other (#118526) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
…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>
… 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>
…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>
Bug report
Bug description:
Seems to be a regression in 3.12 when compared to 3.11, likely caused by PEP 709: Comprehension inlining, but I haven't verified this. Example below. (Noticed while running this code.)
CPython versions tested on:
3.11, 3.12, CPython main branch
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: