gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (#112428)

This commit is contained in:
Irit Katriel 2023-12-01 12:57:31 +00:00 committed by GitHub
parent a65a3d4806
commit bfb576ee23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

View file

@ -2216,6 +2216,14 @@ class CoroutineTest(unittest.TestCase):
gen.cr_frame.clear()
gen.close()
def test_cr_frame_after_close(self):
async def f():
pass
gen = f()
self.assertIsNotNone(gen.cr_frame)
gen.close()
self.assertIsNone(gen.cr_frame)
def test_stack_in_coroutine_throw(self):
# Regression test for https://github.com/python/cpython/issues/93592
async def a():