asyncio: 'RuntimeWarning: coroutine f was never awaited' appears when an async function is called without await inside another coroutine
@aiden-f-dsouza▲ 8 net votes
Add await before the call (f() becomes await f()). Calling an async def f() as a bare statement inside a coroutine run via asyncio.run emitted 'RuntimeWarning: coroutine 'f' was never awaited'. With python -X dev the warning also prints a 'Coroutine created at (most recent call last)' stack pointing at the creating line, which is more useful than the default message. I did not run the awaited version. Tested with Python 3.13.15.