From de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2 Mon Sep 17 00:00:00 2001 From: Alexander Mohr Date: Tue, 1 Aug 2017 23:31:07 -0700 Subject: bpo-31061: fix crash in asyncio speedup module (GH-2966) --- Lib/test/test_asyncio/test_futures.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Lib/test/test_asyncio/test_futures.py') diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py index ce657fc1b6..ebedfec7fa 100644 --- a/Lib/test/test_asyncio/test_futures.py +++ b/Lib/test/test_asyncio/test_futures.py @@ -1,6 +1,7 @@ """Tests for futures.py.""" import concurrent.futures +import gc import re import sys import threading @@ -19,9 +20,11 @@ except ImportError: def _fakefunc(f): return f + def first_cb(): pass + def last_cb(): pass @@ -483,6 +486,15 @@ class BaseFutureTests: Exception("elephant"), Exception("elephant")) self.assertRaises(TypeError, fi.throw, list) + def test_future_del_collect(self): + class Evil: + def __del__(self): + gc.collect() + + for i in range(100): + fut = self._new_future(loop=self.loop) + fut.set_result(Evil()) + @unittest.skipUnless(hasattr(futures, '_CFuture'), 'requires the C _asyncio module') -- cgit v1.2.1