mirror of
https://github.com/python/cpython.git
synced 2025-09-09 18:32:22 +00:00
gh-128396: Fix a crash when inline comprehension has the same local variable as the outside scope (#130235)
This commit is contained in:
parent
5f00501a94
commit
ccf17323c2
3 changed files with 16 additions and 2 deletions
|
@ -346,6 +346,12 @@ class TestFrameLocals(unittest.TestCase):
|
|||
self.assertEqual(x, 2)
|
||||
self.assertEqual(y, 3)
|
||||
|
||||
def test_closure_with_inline_comprehension(self):
|
||||
lambda: k
|
||||
k = 1
|
||||
lst = [locals() for k in [0]]
|
||||
self.assertEqual(lst[0]['k'], 0)
|
||||
|
||||
def test_as_dict(self):
|
||||
x = 1
|
||||
y = 2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue