Open trivialfis opened 2 months ago
Bug Report
With the latest mypy 1.11.0, it reports errors for awaiting an awaitable object. For previous versions, there was no error.
To Reproduce
from typing import Any, Awaitable, Generator class MyClass: def __init__(self) -> None: self.foo = "bar" def __await__(self) -> Generator["MyClass"]: yield self async def fn() -> None: test = await MyClass()
Expected Behavior
No error, or a more concise error that uses the yield type of __await__ instead of __init__ (None).
__await__
__init__
Actual Behavior
Function does not return a value (it only ever returns None) [func-returns-value]
Your Environment
mypy.ini
[mypy] ignore_missing_imports = True disallow_untyped_defs = True follow_imports = silent
Shouldn't this be Generator[Any, None, "MyClass"]?
Generator[Any, None, "MyClass"]
Wouldn't it make MyClass the return type instead of the yield type?
MyClass
Bug Report
With the latest mypy 1.11.0, it reports errors for awaiting an awaitable object. For previous versions, there was no error.
To Reproduce
Expected Behavior
No error, or a more concise error that uses the yield type of
__await__
instead of__init__
(None).Actual Behavior
Your Environment
mypy.ini
(and other config files):