You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy's behaviour is correct here, as inspect.isawaitable is annotated using TypeGuard in typeshed, and TypeGuard doesn't apply type narrowing in the negative case (only in the positive case). This is specified in PEP 674 and is implemented correctly by mypy.
There has been discussion of a stricter version of TypeGuard that could apply type narrowing in the negative case (python/typing#996, python/typing#926), which you might be interested in. However, that would be a new feature in the typing system, so can't be done currently.
Bug Report
https://mypy-play.net/?mypy=1.4.0&python=3.10&gist=5ab30e161d5e83a16538d790c9c2deb9
Expected Behavior
No errors
Actual Behavior
Error
The text was updated successfully, but these errors were encountered: