[New-bugs-announce] [issue35792] Specifying AbstractEventLoop.run_in_executor as a coroutine conflicts with implementation/intent

Christopher Hunt report at bugs.python.org
Sun Jan 20 21:59:18 EST 2019


New submission from Christopher Hunt <chrahunt at gmail.com>:

Currently AbstractEventLoop.run_in_executor is specified as a coroutine, while BaseEventLoop.run_in_executor is actually a non-coroutine that returns a Future object. The behavior of BaseEventLoop.run_in_executor would be significantly different if changed to align with the interface . If run_in_executor is a coroutine then the provided func will not actually be scheduled until the coroutine is awaited, which conflicts with the statement in PEP 3156 that it "is equivalent to `wrap_future(executor.submit(callback, *args))`".

There has already been an attempt in bpo-32327 to convert this function to a coroutine. We should change the interface specified in `AbstractEventLoop` to indicate that `run_in_executor` is not a coroutine, which should help ensure it does not get changed in the future without full consideration of the impacts.

----------
components: asyncio
messages: 334109
nosy: asvetlov, chrahunt, yselivanov
priority: normal
severity: normal
status: open
title: Specifying AbstractEventLoop.run_in_executor as a coroutine conflicts with implementation/intent
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list