Skip to content

Unnecessary async/await (ARCH2025)

Key python.async.unnecessary-async-await · Severity info · Category async

An async function whose only await is on the single returned expression adds a state-machine and microtask hop with no benefit. Returning the coroutine directly yields the same result with less overhead.

async def get_user(user_id):
return await fetch_user(user_id) # the only await is the return
def get_user(user_id):
return fetch_user(user_id) # return the coroutine directly

Drop the async/await pair and return the coroutine directly; the caller will await it.