]> granicus.if.org Git - python/commitdiff
call remove_done_callback in finally section (#1688)
authorjimmylai <albert_chs@yahoo.com.tw>
Tue, 23 May 2017 05:32:46 +0000 (22:32 -0700)
committerŁukasz Langa <lukasz@langa.pl>
Tue, 23 May 2017 05:32:46 +0000 (22:32 -0700)
Lib/asyncio/base_events.py

index 3ff511be44a67e324bdb05332f74d044f6d52efd..33b8f4887c6a64e1674ce69340305b5cec6170a0 100644 (file)
@@ -458,7 +458,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.')