mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-104404: fix crasher with nested comprehensions plus lambdas (#104442)
This commit is contained in:
parent
1eb950ca55
commit
563c7dcba0
2 changed files with 22 additions and 7 deletions
|
@ -338,6 +338,14 @@ class ListComprehensionTest(unittest.TestCase):
|
|||
outputs = {"y": [1, 3, 5]}
|
||||
self._check_in_scopes(code, outputs)
|
||||
|
||||
def test_nested_4(self):
|
||||
code = """
|
||||
items = [([lambda: x for x in range(2)], lambda: x) for x in range(3)]
|
||||
out = [([fn() for fn in fns], fn()) for fns, fn in items]
|
||||
"""
|
||||
outputs = {"out": [([1, 1], 2), ([1, 1], 2), ([1, 1], 2)]}
|
||||
self._check_in_scopes(code, outputs)
|
||||
|
||||
def test_nameerror(self):
|
||||
code = """
|
||||
[x for x in [1]]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue