You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It does what's supposed to, runs a callback in the main thread after the the function runs in the executor. And everything is typed. However, using mypy:
$ mypy script.py
script.py:17: error: Argument 1 to "add_future" of "IOLoop" has incompatible type "Awaitable[int]"; expected "Union[asyncio.futures.Future[int], concurrent.futures._base.Future[int]]"
I see the type annotations were all added for both functions on the same commit afe7dc5
Is there a reason run_in_executor returns Awaitable[_T] and not Future[_T]?
The text was updated successfully, but these errors were encountered:
run_in_executor returns Awaitable because that's what the corresponding asyncio method is typed to return. If I'm following the various threads correctly (starting with python/typeshed#3999), now that https://bugs.python.org/issue40782 has been fixed in cpython, we need a typeshed PR to change the return type of AbstractEventLoop.run_in_executor from Awaitable to Future, and then we can make the same change in Tornado.
It does what's supposed to, runs a callback in the main thread after the the function runs in the executor. And everything is typed. However, using mypy:
I see the type annotations were all added for both functions on the same commit afe7dc5
Is there a reason
run_in_executor
returnsAwaitable[_T]
and notFuture[_T]
?The text was updated successfully, but these errors were encountered: