aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_futures.py
diff options
context:
space:
mode:
authorAlexander Mohr <thehesiod@users.noreply.github.com>2017-08-01 23:31:07 -0700
committerINADA Naoki <methane@users.noreply.github.com>2017-08-02 15:31:07 +0900
commitde34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2 (patch)
tree12fc6ed6dc8e1e23fd75d6b35c29dda2b8469cea /Lib/test/test_asyncio/test_futures.py
parent47320a652e872003f3dd3a9db4243067b09dd316 (diff)
downloadcpython-de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2.tar.gz
cpython-de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2.zip
bpo-31061: fix crash in asyncio speedup module (GH-2966)
Diffstat (limited to 'Lib/test/test_asyncio/test_futures.py')
-rw-r--r--Lib/test/test_asyncio/test_futures.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures.py b/Lib/test/test_asyncio/test_futures.py
index ce657fc1b6a..ebedfec7fa3 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')