diff options
author | Carl Meyer <carl@oddbird.net> | 2023-05-18 21:22:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-18 21:22:03 (GMT) |
commit | 0589c6a4d3d822cace42050198cb9a5e99c879ad (patch) | |
tree | ae6785cbe277413976d6513d80f42206477d5f0b /Lib/test/test_listcomps.py | |
parent | dcdc90d384723920e8dea0ee04eae8c219333634 (diff) | |
download | cpython-0589c6a4d3d822cace42050198cb9a5e99c879ad.zip cpython-0589c6a4d3d822cace42050198cb9a5e99c879ad.tar.gz cpython-0589c6a4d3d822cace42050198cb9a5e99c879ad.tar.bz2 |
gh-104615: don't make unsafe swaps in apply_static_swaps (#104620)
Diffstat (limited to 'Lib/test/test_listcomps.py')
-rw-r--r-- | Lib/test/test_listcomps.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py index 985274d..ae63f4a 100644 --- a/Lib/test/test_listcomps.py +++ b/Lib/test/test_listcomps.py @@ -484,6 +484,12 @@ class ListComprehensionTest(unittest.TestCase): """ self._check_in_scopes(code, {"z": 1, "out": [(3, 2, 1)]}) + def test_assign_to_comp_iter_var_in_outer_function(self): + code = """ + a = [1 for a in [0]] + """ + self._check_in_scopes(code, {"a": [1]}, scopes=["function"]) + __test__ = {'doctests' : doctests} |