-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing warning for unawaited coroutine when invoking method in superclass #14113
Comments
I don't think mypy has a feature to detect unawaited coroutines. In general, it's not a bug to return a coroutine without awaiting it. Using a coroutine in a conditional expression (especially when applying a |
I was probably thinking of this. Maybe truthy-function handles this, though, and I should be turning that on. |
I've confirmed truthy-function also does not catch this, so maybe this is still a bug? |
The super() calls are a red herring, here's a simpler repro: async def func() -> bool:
return True
async def func2() -> None:
if func():
print("hi") I think this should be a new feature detecting that |
Worth noting that truthy-bool does catch both these cases. So maybe that's sufficient?
|
Thanks, I didn't try that code. I think that's enough. |
I believe |
This sounds reasonable to me. It seems unlikely to produce a false positive, at least if strict optional checking is enabled. |
Created #16069. |
Bug Report
An edge-case where warn-unawaited-coroutine does not work.
To Reproduce
Expected Behavior
Should warn about unawaited coroutine/incompatible type.
Actual Behavior
No warning.
Your Environment
mypy 0.971
The text was updated successfully, but these errors were encountered: