-
Notifications
You must be signed in to change notification settings - Fork 766
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
Wrong None detection. #4743
Comments
Thanks for the bug report. I think this is already fixed in last week's pre-release version of pylance, and the fix will be in this week's production version. You can temporarily switch to the pre-release version of pylance, and the error should go away. |
Thank you! I confirm, the bug was fixed in the last pre-release version. |
I dont know if this related to this issue, but seems similar. In release (2023.8.30) version i have bug with this code: class Param:
bar: int
async def foo(param):
return param.bar
async def bar():
reveal_type(foo) # Type of "foo" is "(param: Unknown) -> Coroutine[Any, Any, Unknown]"
reveal_type(foo(int())) # Type of "foo(int())" is "Unknown" # Just as example of param without 'bar' attribute
reveal_type(foo(Param())) # Type of "foo(Param())" is "int"
await foo(Param()) # "int" is not awaitable Switching to pre-release version fix issue, but there is another one: async def foo():
reveal_type(foo) # Type of "foo" is "() -> Coroutine[Any, Any, None]"
reveal_type(foo()) # Type of "foo()" is "None"
await foo() # "None" is not awaitable Hope this helps. |
@Elchinchel, the last code sample that you posted above is a duplicate of microsoft/pyright#5745, which will be fixed in this week's pylance pre-release build. It's specific to recursive coroutine calls. You can work around it in the meantime by adding an explicit |
After update, pylance says "None" is not awaitable. But I clearly defined the type. With the old version, I have no problem with this piece of code.
The text was updated successfully, but these errors were encountered: