diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 03a31ec6a05726b..56a54b002df773f 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -268,6 +268,12 @@ def loop(): #This should not raise loop() + def test_issue125038(self): + g = (x for x in range(10)) + g.gi_frame.f_locals['.0'] = range(20) + l = list(g) + self.assertListEqual(l, []) + class ExceptionTest(unittest.TestCase): # Tests for the issue #23353: check that the currently handled exception # is correctly saved/restored in PyEval_EvalFrameEx().