Message281043
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. |
|
Date |
User |
Action |
Args |
2016-11-17 15:43:29 | allenap | set | recipients:
+ allenap, gvanrossum, yselivanov |
2016-11-17 15:43:29 | allenap | set | messageid: <1479397409.08.0.1550595702.issue28725@psf.upfronthosting.co.za> |
2016-11-17 15:43:28 | allenap | link | issue28725 messages |
2016-11-17 15:43:28 | allenap | create | |
|