]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
ioloop: Annotate run_in_executor returning Future, not Awaitable 3303/head
authorBen Darnell <ben@bendarnell.com>
Thu, 27 Jul 2023 02:00:20 +0000 (22:00 -0400)
committerBen Darnell <ben@bendarnell.com>
Thu, 27 Jul 2023 02:06:53 +0000 (22:06 -0400)
This required a recent update to typeshed/mypy.

Fixes #3093

tornado/ioloop.py
tornado/platform/asyncio.py

index 450fbf9484d29cfdac54c417f50c5a0286aac9e5..cdfb4a630fd063f61b2818ea5d5f9dd1b38636fd 100644 (file)
@@ -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.
 
index 32fe860a66fc7bdd39b2429060315e493f7a1685..8d16aa6d15be0f7c537bb5e99f32fe5d87f4a8d5 100644 (file)
@@ -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: