Skip to content

Commit 58f39d9

Browse files
authored
Apply suggestions from code review
1 parent 620a344 commit 58f39d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/asyncio/staggered.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ async def staggered_race(coro_fns, delay, *, loop=None):
6666
enum_coro_fns = enumerate(coro_fns)
6767
winner_result = None
6868
winner_index = None
69+
unhandled_exceptions = []
70+
exceptions = []
6971
running_tasks = set()
7072
on_completed_fut = None
7173

@@ -142,8 +144,7 @@ async def run_one_coro(ok_to_start, previous_failed) -> None:
142144
if t is not current_task:
143145
t.cancel()
144146

145-
unhandled_exceptions = []
146-
exceptions = []
147+
propagate_cancellation_error = None
147148
try:
148149
ok_to_start = locks.Event()
149150
first_task = loop.create_task(run_one_coro(ok_to_start, None))
@@ -154,8 +155,7 @@ async def run_one_coro(ok_to_start, previous_failed) -> None:
154155
propagate_cancellation_error = None
155156
# Make sure no tasks are left running if we leave this function
156157
while running_tasks:
157-
if on_completed_fut is None:
158-
on_completed_fut = loop.create_future()
158+
on_completed_fut = loop.create_future()
159159
try:
160160
await on_completed_fut
161161
except exceptions_mod.CancelledError as ex:

0 commit comments

Comments
 (0)