[3.6] call remove_done_callback in finally section (GH-1688) (#1755)

(cherry picked from commit 21b3e04c13)
This commit is contained in:
Łukasz Langa 2017-05-23 00:36:23 -07:00 committed by GitHub
parent 762add7877
commit 70705e3cdf
1 changed files with 2 additions and 1 deletions

View File

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