New submission from Gavin Panella:
The following will sleep:
async def one():
await asyncio.sleep(10)
async def two():
await one()
loop.run_until_complete(two())
but the following will not:
async def one():
return asyncio.sleep(10)
async def two():
await one()
loop.run_until_complete(two())
I would expect run_until_complete to keep bouncing awaitable results back into
the event-loop until a non-awaitable is returned. In my code I work around this
with:
result = loop.run_until_complete(...)
while inspect.isawaitable(result):
result = loop.run_until_complete(result)
I would also expect that the await in `two` would have DTRT with the returned
generator/coroutine.
----------
components: asyncio
messages: 281043
nosy: allenap, gvanrossum, yselivanov
priority: normal
severity: normal
status: open
title: Awaiting an awaitable returned from an async function does nothing
type: behavior
versions: Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28725>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com