gh-104615: don't make unsafe swaps in apply_static_swaps (#104620)

This commit is contained in:
Carl Meyer 2023-05-18 15:22:03 -06:00 committed by GitHub
parent dcdc90d384
commit 0589c6a4d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 95 additions and 20 deletions

View file

@ -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}