STINNER Victor <vstin...@redhat.com> added the comment:
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 ;-) ---------- nosy: +vstinner resolution: -> not a bug stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36222> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com