Skip to content

'Maybe you forgot to use "await"?' has wrong error code #16202

@JelleZijlstra

Description

@JelleZijlstra
from typing import AsyncGenerator


async def f() -> AsyncGenerator[str, None]:
    raise Exception("fooled you")


async def g() -> None:
    async for y in f():  # type: ignore[attr-defined]
        print(y)
% mypy ~/py/tmp/asyncgen.py
/Users/jelle/py/tmp/asyncgen.py:9: note: Maybe you forgot to use "await"?
/Users/jelle/py/tmp/asyncgen.py:9: note: Error code "misc" not covered by "type: ignore" comment
Success: no issues found in 1 source file

Mypy produces an error code of "attr-defined" (correctly) and produced a note that is also correct, but apparently the note has the "misc" error code instead of "attr-defined".

Tried on current master with Python 3.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions