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 vstinner
Recipients asvetlov, natim, vstinner, yselivanov
Date 2019-03-07.09:30:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1551951054.0.0.689863088081.issue36222@roundup.psfhosted.org>
In-reply-to
Content
asyncio.run() requires a coroutine, whereas gather() returns a subclass of asyncio.Future.
https://docs.python.org/dev/library/asyncio-task.html#asyncio.run

You can wrap gather() into a coroutine like that:
---
async def main():
    await asyncio.gather(mocked_function())

asyncio.run(main())
---

loop.run_until_complete() is different. It requires a "future", not a coroutine.
https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.loop.run_until_complete

gather() creates a future which is linked to the current event loop, whereas asyncio.run() creates a new event loop for the lifetime of run(). You should not pass a Future from an event loop to another event loop.

It's not a bug ;-)
History
Date User Action Args
2019-03-07 09:30:54vstinnersetrecipients: + vstinner, asvetlov, yselivanov, natim
2019-03-07 09:30:54vstinnersetmessageid: <1551951054.0.0.689863088081.issue36222@roundup.psfhosted.org>
2019-03-07 09:30:53vstinnerlinkissue36222 messages
2019-03-07 09:30:53vstinnercreate