From 4bf328162b49fdaff8f0c47cb9b7a55d4840e514 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Sat, 29 Jan 2022 01:07:01 +0100 Subject: [PATCH] Deprecate run_until_first_complete --- setup.cfg | 1 + starlette/concurrency.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/setup.cfg b/setup.cfg index 3089eaaf7..9fe0d0c19 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,6 +29,7 @@ filterwarnings= ignore: The 'variables' alias has been deprecated. Please use 'variable_values' instead\.:DeprecationWarning # Workaround for Python 3.9.7 (see https://bugs.python.org/issue45097) ignore:The loop argument is deprecated since Python 3\.8, and scheduled for removal in Python 3\.10\.:DeprecationWarning:asyncio + ignore: run_until_first_complete is deprecated and will be removed in a future version.:DeprecationWarning [coverage:run] source_pkgs = starlette, tests diff --git a/starlette/concurrency.py b/starlette/concurrency.py index 78602077a..f0c45ceff 100644 --- a/starlette/concurrency.py +++ b/starlette/concurrency.py @@ -1,6 +1,7 @@ import functools import sys import typing +import warnings import anyio @@ -20,6 +21,12 @@ async def run_until_first_complete(*args: typing.Tuple[typing.Callable, dict]) -> None: + warnings.warn( + "run_until_first_complete is deprecated " + "and will be removed in a future version.", + DeprecationWarning, + ) + async with anyio.create_task_group() as task_group: async def run(func: typing.Callable[[], typing.Coroutine]) -> None: