Skip to content

Commit 10e8035

Browse files
committed
PR feedback
1 parent 82f1b95 commit 10e8035

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_listcomps.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,16 +710,19 @@ def test_multiple_comprehension_name_reuse(self):
710710
self._check_in_scopes(code, {"x": 2, "y": [2]}, ns={"x": 3}, scopes=["function", "module"])
711711

712712
def test_name_collision_locals(self):
713+
# GH-130809: The existence of a hidden fast from list comprehension should not cause
714+
# frame.f_locals on module level to return a new dict every time it is accessed.
715+
713716
code = """
714717
import sys
715718
frame = sys._getframe()
716719
f_locals = frame.f_locals
717720
foo = 1
718721
[foo for foo in [0]]
719722
from abc import *
720-
assert frame.f_locals is f_locals
723+
same_f_locals = frame.f_locals is f_locals
721724
"""
722-
self._check_in_scopes(code, {"foo": 1}, scopes=["module"])
725+
self._check_in_scopes(code, {"foo": 1, "same_f_locals": True}, scopes=["module"])
723726

724727
def test_exception_locations(self):
725728
# The location of an exception raised from __init__ or

0 commit comments

Comments
 (0)