From 7075748eb341c661bd2f4efeb88963442ce3f85e Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Wed, 26 Jul 2023 22:00:20 -0400 Subject: [PATCH] ioloop: Annotate run_in_executor returning Future, not Awaitable This required a recent update to typeshed/mypy. Fixes #3093 --- tornado/ioloop.py | 2 +- tornado/platform/asyncio.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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: -- 2.47.2