mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
gh-108732: include comprehension locals in frame.f_locals (#109026)
Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
b72251de93
commit
f2584eade3
3 changed files with 19 additions and 4 deletions
|
@ -596,6 +596,13 @@ class ListComprehensionTest(unittest.TestCase):
|
|||
"""
|
||||
self._check_in_scopes(code, {"value": [1, None]})
|
||||
|
||||
def test_frame_locals(self):
|
||||
code = """
|
||||
val = [sys._getframe().f_locals for a in [0]][0]["a"]
|
||||
"""
|
||||
import sys
|
||||
self._check_in_scopes(code, {"val": 0}, ns={"sys": sys})
|
||||
|
||||
|
||||
__test__ = {'doctests' : doctests}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue