Skip to content

Commit 5d2b57e

Browse files
committed
Add test code to ensure python#91887 is fixed
1 parent 9a5ada0 commit 5d2b57e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_asyncio/test_tasks.py

+8
Original file line numberDiff line numberDiff line change
@@ -2279,6 +2279,14 @@ async def kill_me(loop):
22792279
source_traceback = task._source_traceback
22802280
task = None
22812281

2282+
# no more reference to kill_me() task in user code. the task
2283+
# should be kept alive as long as it is pending and we hold a
2284+
# reference to the event loop (#91887)
2285+
support.gc_collect()
2286+
2287+
self.assertEqual(len(asyncio.all_tasks(loop=self.loop)), 1)
2288+
mock_handler.assert_not_called()
2289+
22822290
# remove strong reference held by the event loop
22832291
self.loop._pending_tasks.clear()
22842292

0 commit comments

Comments
 (0)