Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Sep 26, 2024
1 parent e11a52a commit 3fbbedb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
11 changes: 1 addition & 10 deletions Lib/asyncio/staggered.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class _Done(Exception):
pass

async def staggered_race(coro_fns, delay, *, loop=None):
async def staggered_race(coro_fns, delay):
"""Run coroutines with staggered start times and take the first to finish.
This method takes an iterable of coroutine functions. The first one is
Expand Down Expand Up @@ -65,15 +65,6 @@ async def staggered_race(coro_fns, delay, *, loop=None):
winner_index = None
exceptions = []

if loop is not None:
import warnings
warnings._deprecated(
'loop',
'the {name!r} parameter is deprecated and slated for removal in '
'Python {remove}; it is ignored since 3.14',
remove=(3, 16),
)

async def run_one_coro(this_index, coro_fn, this_failed):
try:
result = await coro_fn()
Expand Down
6 changes: 4 additions & 2 deletions Lib/test/test_asyncio/test_eager_task_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ async def run():

self.run_coro(run())

# See GH-124309 for both of these
def test_staggered_race_with_eager_tasks(self):
# See https://github.com/python/cpython/issues/124309

async def fail():
await asyncio.sleep(0) # Dummy coroutine
await asyncio.sleep(0)
raise ValueError("no good")

async def run():
Expand All @@ -237,6 +238,7 @@ async def run():
self.run_coro(run())

def test_staggered_race_with_eager_tasks_no_delay(self):
# See https://github.com/python/cpython/issues/124309
async def fail():
raise ValueError("no good")

Expand Down

0 comments on commit 3fbbedb

Please sign in to comment.