Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update test to also verify isolation
  • Loading branch information
carljm committed May 10, 2023
commit b5c8c800364752b9796238252d28e368b6c0eb9d
7 changes: 4 additions & 3 deletions Lib/test/test_listcomps.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ def test_inner_cell_shadows_outer(self):
def test_inner_cell_shadows_outer_no_store(self):
Comment thread
carljm marked this conversation as resolved.
code = """
def f(x):
return [lambda: x for x in range(x)]
y = [fn() for fn in f(2)]
return [lambda: x for x in range(x)], x
fns, x = f(2)
y = [fn() for fn in fns]
"""
outputs = {"y": [1, 1]}
outputs = {"y": [1, 1], "x": 2}
self._check_in_scopes(code, outputs)

def test_closure_can_jump_over_comp_scope(self):
Expand Down