From f142e85d22ba135d5205280240f3a2fe1df2649f Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Wed, 2 Aug 2017 16:50:39 +0900 Subject: bpo-31061: fix crash in asyncio speedup module (GH-2984) (cherry picked from commit de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2) --- Lib/test/test_asyncio/test_tasks.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Lib/test/test_asyncio/test_tasks.py') diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 195a1ed407..243faf6b04 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -3,6 +3,7 @@ import collections import contextlib import functools +import gc import io import os import re @@ -92,6 +93,20 @@ class BaseTaskTests: self.loop.set_task_factory(self.new_task) self.loop.create_future = lambda: self.new_future(self.loop) + def test_task_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + @asyncio.coroutine + def run(): + return Evil() + + self.loop.run_until_complete( + asyncio.gather(*[ + self.new_task(self.loop, run()) for _ in range(100) + ], loop=self.loop)) + def test_other_loop_future(self): other_loop = asyncio.new_event_loop() fut = self.new_future(other_loop) -- cgit v1.2.1