From 879eb68257e3797f457c37ccf8551c41ff4b5dd6 Mon Sep 17 00:00:00 2001 From: Lucina Date: Mon, 12 Dec 2022 06:46:18 +0000 Subject: [PATCH 1/2] Add loop_factory argument to asyncio.run on 3.12+ --- stdlib/asyncio/runners.pyi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 49d236bbee9e..4a4d1e201515 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -21,6 +21,11 @@ if sys.version_info >= (3, 11): def get_loop(self) -> AbstractEventLoop: ... def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = ...) -> _T: ... +if sys.version_info >= (3, 12): + def run( + main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ... + ) -> _T: ... + if sys.version_info >= (3, 8): def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = ...) -> _T: ... From 879ba9ab8f75906fa6e9c3e6a8239edba86a8bb0 Mon Sep 17 00:00:00 2001 From: Lucina Date: Mon, 12 Dec 2022 06:49:24 +0000 Subject: [PATCH 2/2] Fix if, elif branch --- stdlib/asyncio/runners.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 4a4d1e201515..8a96b82dc5da 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -26,7 +26,7 @@ if sys.version_info >= (3, 12): main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ... ) -> _T: ... -if sys.version_info >= (3, 8): +elif sys.version_info >= (3, 8): def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = ...) -> _T: ... else: