diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-10-03 23:36:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-03 23:36:52 (GMT) |
commit | 93fcc1f4133e177882850177c2c047d46019b812 (patch) | |
tree | 523560275ae44387a418e9f18c0df6eb2a69993f /Lib/test | |
parent | d053c47bfde1b3d8779546b980849708662f2660 (diff) | |
download | cpython-93fcc1f4133e177882850177c2c047d46019b812.zip cpython-93fcc1f4133e177882850177c2c047d46019b812.tar.gz cpython-93fcc1f4133e177882850177c2c047d46019b812.tar.bz2 |
GH-97752: Clear the `previous` member of newly-created generator/coroutine frames (GH-97795)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_generators.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index fb2d9ce..42cc20c 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -206,6 +206,25 @@ class GeneratorTest(unittest.TestCase): finally: gc.set_threshold(*thresholds) + def test_ag_frame_f_back(self): + async def f(): + yield + ag = f() + self.assertIsNone(ag.ag_frame.f_back) + + def test_cr_frame_f_back(self): + async def f(): + pass + cr = f() + self.assertIsNone(cr.cr_frame.f_back) + cr.close() # Suppress RuntimeWarning. + + def test_gi_frame_f_back(self): + def f(): + yield + gi = f() + self.assertIsNone(gi.gi_frame.f_back) + class ExceptionTest(unittest.TestCase): |