From 2245b8bc64e2625e88252e828af38ddf58475543 Mon Sep 17 00:00:00 2001 From: Kevin de Ruijter Date: Thu, 8 Jan 2026 04:24:41 +0100 Subject: [PATCH] fix: add eager_start as an argument. (#15211) Co-authored-by: Semyon Moroz --- stdlib/asyncio/base_events.pyi | 11 ++++++++++- stdlib/asyncio/events.pyi | 12 +++++++++++- stdlib/asyncio/taskgroups.pyi | 15 ++++++++++++++- stdlib/asyncio/tasks.pyi | 7 ++++++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 1f493210d..0d8ac2d47 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -83,7 +83,16 @@ class BaseEventLoop(AbstractEventLoop): # Future methods def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 14): + def create_task( + self, + coro: _CoroutineLike[_T], + *, + name: object = None, + context: Context | None = None, + eager_start: bool | None = None, + ) -> Task[_T]: ... + elif sys.version_info >= (3, 11): def create_task(self, coro: _CoroutineLike[_T], *, name: object = None, context: Context | None = None) -> Task[_T]: ... else: def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]: ... diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 5dc698bc5..4f2f45355 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -161,7 +161,17 @@ class AbstractEventLoop: @abstractmethod def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 14): + @abstractmethod + def create_task( + self, + coro: _CoroutineLike[_T], + *, + name: str | None = None, + context: Context | None = None, + eager_start: bool | None = None, + ) -> Task[_T]: ... + elif sys.version_info >= (3, 11): @abstractmethod def create_task( self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 30b7c9129..2968b0719 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -22,5 +22,18 @@ class TaskGroup: async def __aenter__(self) -> Self: ... async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... - def create_task(self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ... + if sys.version_info >= (3, 14): + def create_task( + self, + coro: _CoroutineLike[_T], + *, + name: str | None = None, + context: Context | None = None, + eager_start: bool | None = None, + ) -> Task[_T]: ... + else: + def create_task( + self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None + ) -> Task[_T]: ... + def _on_task_done(self, task: Task[object]) -> None: ... diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 1442f7400..be9b60cd3 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -413,7 +413,12 @@ else: def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ... -if sys.version_info >= (3, 11): +if sys.version_info >= (3, 14): + def create_task( + coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None, eager_start: bool | None = None + ) -> Task[_T]: ... + +elif sys.version_info >= (3, 11): def create_task(coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ... else: