diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2025-02-19 17:11:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-19 17:11:17 (GMT) |
commit | ccf17323c218a2fdcf7f4845d3eaa74ebddefa44 (patch) | |
tree | 7ac99611ee4ba2458137cdf659411bc3d42853bc /Lib/test/test_frame.py | |
parent | 5f00501a940a0fb97870e70066fb301909320388 (diff) | |
download | cpython-ccf17323c218a2fdcf7f4845d3eaa74ebddefa44.zip cpython-ccf17323c218a2fdcf7f4845d3eaa74ebddefa44.tar.gz cpython-ccf17323c218a2fdcf7f4845d3eaa74ebddefa44.tar.bz2 |
gh-128396: Fix a crash when inline comprehension has the same local variable as the outside scope (#130235)
Diffstat (limited to 'Lib/test/test_frame.py')
-rw-r--r-- | Lib/test/test_frame.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py index 4d08606..a6e11f1 100644 --- a/Lib/test/test_frame.py +++ b/Lib/test/test_frame.py @@ -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 |