Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions stdlib/@tests/test_cases/asyncio/check_task.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion stdlib/asyncio/base_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
3 changes: 2 additions & 1 deletion stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down