diff --git a/stdlib/@tests/test_cases/asyncio/check_task.py b/stdlib/@tests/test_cases/asyncio/check_task.py index 69bcf8f782aa..6aca768d4b8e 100644 --- a/stdlib/@tests/test_cases/asyncio/check_task.py +++ b/stdlib/@tests/test_cases/asyncio/check_task.py @@ -1,6 +1,10 @@ from __future__ import annotations import asyncio +import sys +from asyncio.base_events import BaseEventLoop +from collections.abc import Coroutine +from typing import Any class Waiter: @@ -18,6 +22,15 @@ async def foo() -> int: return 42 +if sys.version_info >= (3, 13): + + def check_loop_create_task_eager_start( + loop: asyncio.AbstractEventLoop, base_loop: BaseEventLoop, coro: Coroutine[Any, Any, int] + ) -> None: + loop.create_task(coro, eager_start=True) + base_loop.create_task(coro, eager_start=True) + + async def main() -> None: # asyncio.Task is covariant in its type argument, which is unusual since its parent class # asyncio.Future is invariant in its type argument. This is only sound because asyncio.Task diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 3c7d8c2ce02e..056d9a2d36c9 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -83,7 +83,8 @@ class BaseEventLoop(AbstractEventLoop): # Future methods def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 14): + # `eager_start` is supported as an arbitrary kwarg starting in 3.13.3. + if sys.version_info >= (3, 13): def create_task( self, coro: _CoroutineLike[_T], diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index db826ff1c2e5..12978a97679f 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -161,7 +161,8 @@ class AbstractEventLoop: @abstractmethod def create_future(self) -> Future[Any]: ... # Tasks methods - if sys.version_info >= (3, 14): + # `eager_start` is supported as an arbitrary kwarg starting in 3.13.3. + if sys.version_info >= (3, 13): @abstractmethod def create_task( self,