Skip to content

Commit 70705e3

Browse files
authored
[3.6] call remove_done_callback in finally section (GH-1688) (#1755)
(cherry picked from commit 21b3e04)
1 parent 762add7 commit 70705e3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/asyncio/base_events.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,8 @@ def run_until_complete(self, future):
459459
# local task.
460460
future.exception()
461461
raise
462-
future.remove_done_callback(_run_until_complete_cb)
462+
finally:
463+
future.remove_done_callback(_run_until_complete_cb)
463464
if not future.done():
464465
raise RuntimeError('Event loop stopped before Future completed.')
465466

0 commit comments

Comments
 (0)