Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
  • Loading branch information
JelleZijlstra and Eclips4 authored May 3, 2024
1 parent b48ab2a commit 921718d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Lib/test/test_listcomps.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,13 @@ def test_multiple_comprehension_name_reuse(self):
"""
self._check_in_scopes(code, {"y": [3]}, ns={"x": 3})

code = """
x = 2
[x for x in [1]]
y = [x for _ in [1]]
"""
self._check_in_scopes(code, {"x": 2, "y": [3]}, ns={"x": 3}, scopes=["class"])
self._check_in_scopes(code, {"x": 2, "y": [2]}, ns={"x": 3}, scopes=["function", "module"])

__test__ = {'doctests' : doctests}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix incorrect UnboundLocalError when two comprehensions in the same function both reference the same name, and in one comprehension the name is bound while in the other it's an implicit global.
Fix incorrect :exc:`UnboundLocalError` when two comprehensions in the same function both reference the same name, and in one comprehension the name is bound while in the other it's an implicit global.

0 comments on commit 921718d

Please sign in to comment.