File tree Expand file tree Collapse file tree 2 files changed +6
-25
lines changed Expand file tree Collapse file tree 2 files changed +6
-25
lines changed Original file line number Diff line number Diff line change @@ -433,15 +433,12 @@ async def wait_for(fut, timeout):
433433 try :
434434 await waiter
435435 except exceptions .CancelledError :
436- if fut .done ():
437- return fut .result ()
438- else :
439- fut .remove_done_callback (cb )
440- # We must ensure that the task is not running
441- # after wait_for() returns.
442- # See https://bugs.python.org/issue32751
443- await _cancel_and_wait (fut , loop = loop )
444- raise
436+ fut .remove_done_callback (cb )
437+ # We must ensure that the task is not running
438+ # after wait_for() returns.
439+ # See https://bugs.python.org/issue32751
440+ await _cancel_and_wait (fut , loop = loop )
441+ raise
445442
446443 if fut .done ():
447444 return fut .result ()
Original file line number Diff line number Diff line change @@ -1147,22 +1147,6 @@ def gen():
11471147 res = loop .run_until_complete (task )
11481148 self .assertEqual (res , "ok" )
11491149
1150- def test_wait_for_cancellation_race_condition (self ):
1151- def gen ():
1152- yield 0.1
1153- yield 0.1
1154- yield 0.1
1155- yield 0.1
1156-
1157- loop = self .new_test_loop (gen )
1158-
1159- fut = self .new_future (loop )
1160- loop .call_later (0.1 , fut .set_result , "ok" )
1161- task = loop .create_task (asyncio .wait_for (fut , timeout = 1 ))
1162- loop .call_later (0.1 , task .cancel )
1163- res = loop .run_until_complete (task )
1164- self .assertEqual (res , "ok" )
1165-
11661150 def test_wait_for_waits_for_task_cancellation (self ):
11671151 loop = asyncio .new_event_loop ()
11681152 self .addCleanup (loop .close )
You can’t perform that action at this time.
0 commit comments