-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
This code:
async def f() -> None:
pass
async def g() -> None:
f()
is incorrect because f() isn't awaited. This will produce a runtime warning with the right debug settings, but mypy doesn't give any errors.
It would be nice if mypy could catch this, since I think it's a pretty common error in async code. This could be generalized to warning on other types or function return values that shouldn't be ignored (maybe open?), similar to __attribute__((warn_unused_result)) in GCC.
Editing in a 2025 update to the OP
Try --enable-error-code unused-awaitable --enable-error-code truthy-bool and see if that catches the thing you want it to catch
Reactions are currently unavailable