mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
bpo-41891: ensure asyncio.wait_for waits for task completion (#22461)
This commit is contained in:
parent
2179349d8c
commit
17ef4319a3
3 changed files with 66 additions and 1 deletions
|
@ -437,7 +437,10 @@ async def wait_for(fut, timeout):
|
|||
return fut.result()
|
||||
else:
|
||||
fut.remove_done_callback(cb)
|
||||
fut.cancel()
|
||||
# We must ensure that the task is not running
|
||||
# after wait_for() returns.
|
||||
# See https://bugs.python.org/issue32751
|
||||
await _cancel_and_wait(fut, loop=loop)
|
||||
raise
|
||||
|
||||
if fut.done():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue