summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-03 15:35:52 (GMT)
committerGitHub <noreply@github.com>2019-05-03 15:35:52 (GMT)
commit769ac7e7b809dfc60abd0d7e6f020c6ffe06a6c0 (patch)
tree0036212b9185df7ba5f7969745448c5db9fadbbf
parent128e2262a8ffc7b94e44455cc1ba2e0f74316461 (diff)
downloadcpython-769ac7e7b809dfc60abd0d7e6f020c6ffe06a6c0.zip
cpython-769ac7e7b809dfc60abd0d7e6f020c6ffe06a6c0.tar.gz
cpython-769ac7e7b809dfc60abd0d7e6f020c6ffe06a6c0.tar.bz2
bpo-36613: call remove_done_callback if exception (GH-12800)
Call remove_done_callback() in finally block. https://bugs.python.org/issue36613 (cherry picked from commit c1964e9e2177eabe821f3e4243be8b99e0d2d542) Co-authored-by: gescheit <gescheit12@gmail.com>
-rw-r--r--Lib/asyncio/tasks.py3
-rw-r--r--Misc/NEWS.d/next/Library/2019-04-12-13-52-15.bpo-36613.hqT1qn.rst1
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index 416c346..2af4f32 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -457,10 +457,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:
diff --git a/Misc/NEWS.d/next/Library/2019-04-12-13-52-15.bpo-36613.hqT1qn.rst b/Misc/NEWS.d/next/Library/2019-04-12-13-52-15.bpo-36613.hqT1qn.rst
new file mode 100644
index 0000000..8828dcc
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-04-12-13-52-15.bpo-36613.hqT1qn.rst
@@ -0,0 +1 @@
+Fix :mod:`asyncio` wait() not removing callback if exception \ No newline at end of file