bpo-36613: call remove_done_callback if exception (GH-12800)

Call remove_done_callback() in finally block.


https://bugs.python.org/issue36613
This commit is contained in:
gescheit 2019-05-03 18:18:02 +03:00 committed by Miss Islington (bot)
parent 4461d704e2
commit c1964e9e21
2 changed files with 3 additions and 1 deletions

View File

@ -495,10 +495,11 @@ async def _wait(fs, timeout, return_when, loop):
finally:
if timeout_handle is not None:
timeout_handle.cancel()
for f in fs:
f.remove_done_callback(_on_completion)
done, pending = set(), set()
for f in fs:
f.remove_done_callback(_on_completion)
if f.done():
done.add(f)
else:

View File

@ -0,0 +1 @@
Fix :mod:`asyncio` wait() not removing callback if exception