File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2301,16 +2301,19 @@ class Subclass(Task):
23012301 def __del__ (self ):
23022302 pass
23032303
2304- async def coro ():
2304+ async def corofn ():
23052305 await asyncio .sleep (0.01 )
23062306
2307- task = Subclass (coro (), loop = self .loop )
2307+ coro = corofn ()
2308+ task = Subclass (coro , loop = self .loop )
23082309 task ._log_destroy_pending = False
23092310
23102311 del task
23112312
23122313 support .gc_collect ()
23132314
2315+ coro .close ()
2316+
23142317 @mock .patch ('asyncio.base_events.logger' )
23152318 def test_tb_logger_not_called_after_cancel (self , m_log ):
23162319 loop = asyncio .new_event_loop ()
@@ -2716,12 +2719,12 @@ def __str__(self):
27162719 coro = coroutine_function ()
27172720 with contextlib .closing (asyncio .EventLoop ()) as loop :
27182721 task = asyncio .Task .__new__ (asyncio .Task )
2719-
27202722 for _ in range (5 ):
27212723 with self .assertRaisesRegex (RuntimeError , 'break' ):
27222724 task .__init__ (coro , loop = loop , context = obj , name = Break ())
27232725
27242726 coro .close ()
2727+ task ._log_destroy_pending = False
27252728 del task
27262729
27272730 self .assertEqual (sys .getrefcount (obj ), initial_refcount )
You can’t perform that action at this time.
0 commit comments