File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2301,16 +2301,19 @@ class Subclass(Task):
2301
2301
def __del__ (self ):
2302
2302
pass
2303
2303
2304
- async def coro ():
2304
+ async def corofn ():
2305
2305
await asyncio .sleep (0.01 )
2306
2306
2307
- task = Subclass (coro (), loop = self .loop )
2307
+ coro = corofn ()
2308
+ task = Subclass (coro , loop = self .loop )
2308
2309
task ._log_destroy_pending = False
2309
2310
2310
2311
del task
2311
2312
2312
2313
support .gc_collect ()
2313
2314
2315
+ coro .close ()
2316
+
2314
2317
@mock .patch ('asyncio.base_events.logger' )
2315
2318
def test_tb_logger_not_called_after_cancel (self , m_log ):
2316
2319
loop = asyncio .new_event_loop ()
@@ -2716,12 +2719,12 @@ def __str__(self):
2716
2719
coro = coroutine_function ()
2717
2720
with contextlib .closing (asyncio .EventLoop ()) as loop :
2718
2721
task = asyncio .Task .__new__ (asyncio .Task )
2719
-
2720
2722
for _ in range (5 ):
2721
2723
with self .assertRaisesRegex (RuntimeError , 'break' ):
2722
2724
task .__init__ (coro , loop = loop , context = obj , name = Break ())
2723
2725
2724
2726
coro .close ()
2727
+ task ._log_destroy_pending = False
2725
2728
del task
2726
2729
2727
2730
self .assertEqual (sys .getrefcount (obj ), initial_refcount )
You can’t perform that action at this time.
0 commit comments