summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_futures.py
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-08-02 07:50:39 (GMT)
committerGitHub <noreply@github.com>2017-08-02 07:50:39 (GMT)
commitf142e85d22ba135d5205280240f3a2fe1df2649f (patch)
tree32e45abe96a96edf8fb36ecf60588385a1764a16 /Lib/test/test_asyncio/test_futures.py
parent48fcc72c83e1b47b200dd39f9dcc9f62fa0d4d17 (diff)
downloadcpython-f142e85d22ba135d5205280240f3a2fe1df2649f.zip
cpython-f142e85d22ba135d5205280240f3a2fe1df2649f.tar.gz
cpython-f142e85d22ba135d5205280240f3a2fe1df2649f.tar.bz2
bpo-31061: fix crash in asyncio speedup module (GH-2984)
(cherry picked from commit de34cbe9cdaaf7b85fed86f99c2fd071e1a7b1d2)
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 ce657fc..ebedfec 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')