From 1f41b17c4ace021700212746dba676caa3fa25fe Mon Sep 17 00:00:00 2001 From: 0az <30874884+0az@users.noreply.github.com> Date: Tue, 18 Nov 2025 02:06:23 -0800 Subject: [PATCH 1/2] [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: https://github.com/python/cpython/commit/1229cb8c1412d37cf3206eab407f03e21d602cbd --- stdlib/asyncio/runners.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 919e6521f8a1..93683e5b9a94 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import Unused -from collections.abc import Callable, Coroutine +from collections.abc import Awaitable, Callable, Coroutine from contextvars import Context from typing import Any, TypeVar, final from typing_extensions import Self @@ -22,8 +22,10 @@ if sys.version_info >= (3, 11): def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ... def close(self) -> None: ... def get_loop(self) -> AbstractEventLoop: ... - def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ... - + if sys.version_info >= (3, 14): + def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T: ... + else: + def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ... if sys.version_info >= (3, 12): def run( main: Coroutine[Any, Any, _T], *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None From 5ff8e91de4bafd0bc9ede810378c747609c10a44 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 10:15:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/asyncio/runners.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 93683e5b9a94..a100c9bcec6d 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -26,6 +26,7 @@ if sys.version_info >= (3, 11): def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T: ... else: def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ... + if sys.version_info >= (3, 12): def run( main: Coroutine[Any, Any, _T], *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None