Skip to content

Commit

Permalink
ioloop: Annotate run_in_executor returning Future, not Awaitable
Browse files Browse the repository at this point in the history
This required a recent update to typeshed/mypy.

Fixes #3093
  • Loading branch information
bdarnell committed Jul 27, 2023
1 parent 8bfa66a commit 6a0af16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tornado/ioloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ def run_in_executor(
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.
Expand Down
3 changes: 1 addition & 2 deletions tornado/platform/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

from typing import (
Any,
Awaitable,
Callable,
Dict,
List,
Expand Down Expand Up @@ -237,7 +236,7 @@ def run_in_executor(
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:
Expand Down

0 comments on commit 6a0af16

Please sign in to comment.