This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author allenap
Recipients allenap, gvanrossum, yselivanov
Date 2016-11-17.15:43:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479397409.08.0.1550595702.issue28725@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-11-17 15:43:29allenapsetrecipients: + allenap, gvanrossum, yselivanov
2016-11-17 15:43:29allenapsetmessageid: <1479397409.08.0.1550595702.issue28725@psf.upfronthosting.co.za>
2016-11-17 15:43:28allenaplinkissue28725 messages
2016-11-17 15:43:28allenapcreate