diff --git a/Lib/test/test_asyncio/test_taskgroups.py b/Lib/test/test_asyncio/test_taskgroups.py index 0d69a436fdb840..3e4f493e5d0e9b 100644 --- a/Lib/test/test_asyncio/test_taskgroups.py +++ b/Lib/test/test_asyncio/test_taskgroups.py @@ -32,11 +32,7 @@ def get_error_types(eg): def no_other_refs(): # due to gh-124392 coroutines now refer to their locals - coro = asyncio.current_task().get_coro() - frame = sys._getframe(1) - while coro.cr_frame != frame: - coro = coro.cr_await - return [coro] + return [sys._getframe(1).f_generator] def set_gc_state(enabled):