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

Lib/asyncio/base_events.py

index 50153f8d4bd291fa42a4267c99353eb25c966ba0..26a6f1ef859f2d1d9ce44b75c2c672909ab30021 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.')