Missing await (ARCH2029)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key python.async.missing-await · Severity warning · Category async
Using a coroutine-returning call in a condition or value position without await means the coroutine never runs; because a coroutine object is always truthy, conditions evaluate true by accident.
Incorrect
Section titled “Incorrect”async def process(user_id): if is_active(user_id): # coroutine is always truthy, never runs await notify(user_id)Correct
Section titled “Correct”async def process(user_id): if await is_active(user_id): await notify(user_id)Prefix coroutine-returning calls with await so the result is resolved before it is used.