[issue40782] AbstactEventLoop.run_in_executor is listed as an async method, but should actually return a Futrue

Kyle Stanley report at bugs.python.org
Tue May 26 23:37:08 EDT 2020


Kyle Stanley <aeros167 at gmail.com> added the comment:

>From looking at the commit history of AbstactEventLoop.run_in_executor(), it seems that it was previously be a non-coroutine method prior to the conversion from the `@asyncio.coroutine` decorator to `async def` (PR-4753). See https://github.com/python/cpython/blame/ede157331b4f9e550334900b3b4de1c8590688de/Lib/asyncio/events.py#L305.

The only context for the change I can find is the following conversation between Andrew and Yury: https://github.com/python/cpython/pull/4753#issuecomment-350114336. However, the example provided of `connect_read_pipe()` had already been a coroutine at the time for the BaseEventLoop implementation, which makes sense in that case. So, it's not clear to me as to why `run_in_executor()` was also converted to "async def" when its main implementation is not a coroutine. Furthermore, it's documented as an awaitable rather than a coroutine (https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.run_in_executor).

@Andrew do you have any additional context to provide that I'm potentially missing?

----------
nosy: +aeros, asvetlov, yselivanov

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40782>
_______________________________________


More information about the Python-bugs-list mailing list