mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
bpo-31061: fix crash in asyncio speedup module (GH-2966)
This commit is contained in:
parent
47320a652e
commit
de34cbe9cd
4 changed files with 32 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
import collections
|
||||
import contextlib
|
||||
import functools
|
||||
import gc
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
|
@ -91,6 +92,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue