summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_listcomps.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-09-12 13:50:29 (GMT)
committerGitHub <noreply@github.com>2023-09-12 13:50:29 (GMT)
commitd533ab17ec37b457a5cc286f30c7559e358492bf (patch)
tree2260c776dd98ec4e61519099c2b82169fdabe092 /Lib/test/test_listcomps.py
parentaf83d1e8214efc806488226d206c24462686bd1d (diff)
downloadcpython-d533ab17ec37b457a5cc286f30c7559e358492bf.zip
cpython-d533ab17ec37b457a5cc286f30c7559e358492bf.tar.gz
cpython-d533ab17ec37b457a5cc286f30c7559e358492bf.tar.bz2
[3.12] gh-108732: include comprehension locals in frame.f_locals (GH-109026) (#109097)
gh-108732: include comprehension locals in frame.f_locals (GH-109026) (cherry picked from commit f2584eade378910b9ea18072bb1dab3dd58e23bb) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/test/test_listcomps.py')
-rw-r--r--Lib/test/test_listcomps.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py
index bedd99b..c108957 100644
--- a/Lib/test/test_listcomps.py
+++ b/Lib/test/test_listcomps.py
@@ -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}