mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
[3.13] gh-128396: Fix a crash when inline comprehension has the same … (#130311)
[3.13] gh-128396: Fix a crash when inline comprehension has the same local variable as the outside scope (GH-130235)
(cherry picked from commit ccf17323c2
)
This commit is contained in:
parent
5907cd6829
commit
094394a380
3 changed files with 16 additions and 2 deletions
|
@ -298,6 +298,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