From: Ben Darnell Date: Thu, 27 Jul 2023 02:00:20 +0000 (-0400) Subject: ioloop: Annotate run_in_executor returning Future, not Awaitable X-Git-Tag: v6.4.0b1~19^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3303%2Fhead;p=thirdparty%2Ftornado.git ioloop: Annotate run_in_executor returning Future, not Awaitable This required a recent update to typeshed/mypy. Fixes #3093 --- diff --git a/tornado/ioloop.py b/tornado/ioloop.py index 450fbf948..cdfb4a630 100644 --- a/tornado/ioloop.py +++ b/tornado/ioloop.py @@ -711,7 +711,7 @@ class IOLoop(Configurable): executor: Optional[concurrent.futures.Executor], func: Callable[..., _T], *args: Any - ) -> Awaitable[_T]: + ) -> "Future[_T]": """Runs a function in a ``concurrent.futures.Executor``. If ``executor`` is ``None``, the IO loop's default executor will be used. diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index 32fe860a6..8d16aa6d1 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -37,7 +37,6 @@ from tornado.ioloop import IOLoop, _Selectable from typing import ( Any, - Awaitable, Callable, Dict, List, @@ -237,7 +236,7 @@ class BaseAsyncIOLoop(IOLoop): executor: Optional[concurrent.futures.Executor], func: Callable[..., _T], *args: Any, - ) -> Awaitable[_T]: + ) -> "asyncio.Future[_T]": return self.asyncio_loop.run_in_executor(executor, func, *args) def set_default_executor(self, executor: concurrent.futures.Executor) -> None: