From 21b3e04c13212b29e8c35ffc36eed8603fde08f4 Mon Sep 17 00:00:00 2001 From: jimmylai Date: Mon, 22 May 2017 22:32:46 -0700 Subject: call remove_done_callback in finally section (#1688) --- Lib/asyncio/base_events.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/asyncio') 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.') -- cgit v1.2.1