Skip to content

Commit 1f41b17

Browse files
committed
[stdlib] Update asyncio.Runner.run to acccept Awaitable
As all Coroutine instances are also instances of Awaitable, we can just directly relax this type bound. Issue: gh-120284 Link: python/cpython@1229cb8
1 parent ce2998f commit 1f41b17

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stdlib/asyncio/runners.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import Unused
3-
from collections.abc import Callable, Coroutine
3+
from collections.abc import Awaitable, Callable, Coroutine
44
from contextvars import Context
55
from typing import Any, TypeVar, final
66
from typing_extensions import Self
@@ -22,8 +22,10 @@ if sys.version_info >= (3, 11):
2222
def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ...
2323
def close(self) -> None: ...
2424
def get_loop(self) -> AbstractEventLoop: ...
25-
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ...
26-
25+
if sys.version_info >= (3, 14):
26+
def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T: ...
27+
else:
28+
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ...
2729
if sys.version_info >= (3, 12):
2830
def run(
2931
main: Coroutine[Any, Any, _T], *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None

0 commit comments

Comments
 (0)