]> granicus.if.org Git - python/commitdiff
[3.6] call remove_done_callback in finally section (GH-1688) (#1755)
authorŁukasz Langa <lukasz@langa.pl>
Tue, 23 May 2017 07:36:23 +0000 (00:36 -0700)
committerGitHub <noreply@github.com>
Tue, 23 May 2017 07:36:23 +0000 (00:36 -0700)
(cherry picked from commit 21b3e04c13212b29e8c35ffc36eed8603fde08f4)

Lib/asyncio/base_events.py

index 0df58c5f873d88bc65e0538247d04df8fd5f05ec..a4967b854c5e68d9d689d0a446ba091aee0e2ba6 100644 (file)
@@ -459,7 +459,8 @@ class BaseEventLoop(events.AbstractEventLoop):
                 # local task.
                 future.exception()
             raise
-        future.remove_done_callback(_run_until_complete_cb)
+        finally:
+            future.remove_done_callback(_run_until_complete_cb)
         if not future.done():
             raise RuntimeError('Event loop stopped before Future completed.')