From 4f52d2016bb2f6f57aeb9164cec20ddd50cb1a07 Mon Sep 17 00:00:00 2001 From: Mikhail Efimov Date: Mon, 7 Oct 2024 19:13:24 +0300 Subject: [PATCH] gh-125038: Test on gi_frame.f_locals change for a generator --- Lib/test/test_generators.py | 6 ++++++ 1 file changed, 6 insertions(+) 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().