Skip to content

[1.4] Regression with AsyncGenerator #15489

Closed
@Dreamsorcerer

Description

@Dreamsorcerer

Bug Report

I can't seem to find a minimal reproducer, but whenever using watchfiles.awatch(), mypy produces the error:
error: "Coroutine[Any, Any, AsyncGenerator[set[tuple[Change, str]], None]]" has no attribute "__aiter__" (not async iterable) [attr-defined]

As can be seen in the aiohttp-devtools repo:
https://github.com/aio-libs/aiohttp-devtools/actions/runs/5328161994/jobs/9652470528?pr=572

To Reproduce

from watchfiles import awatch

async def main() -> None:
    async for i in awatch("/foo"):
        print(i)

Expected Behavior

No error, as in mypy<1.4.
Not sure what exactly triggers the error, as writing another async iterator function myself does not trigger it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-asyncasync, await, asyncio

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions