From: jimmylai Date: Tue, 23 May 2017 05:32:46 +0000 (-0700) Subject: call remove_done_callback in finally section (#1688) X-Git-Tag: v3.7.0a1~763 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=21b3e04c13212b29e8c35ffc36eed8603fde08f4;p=python call remove_done_callback in finally section (#1688) --- diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py index 3ff511be44..33b8f4887c 100644 --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -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.')