Closed
Description
The following line in asyncio/events.pyi:
@abstractmethod
async def run_in_executor(self, executor: Any,
func: Callable[..., _T], *args: Any) -> _T: ...
Does not match the actual observed behaviour of this method at runtime:
Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import asyncio
>>> loop = asyncio.get_event_loop()
>>> def do_nothing():
... pass
...
>>> f = loop.run_in_executor(None, do_nothing)
>>> f
<Future pending cb=[_chain_future.<locals>._call_check_cancel() at /usr/lib/python3.6/asyncio/futures.py:403]>
>>> type(f)
<class '_asyncio.Future'>
>>>
Suggest that the type annotation should instead be:
@abstractmethod
def run_in_executor(self, executor: Any,
func: Callable[..., _T], *args: Any) -> Future[_T]: ...