Skip to content

False positive on await for AbstractEventLoop.create_connection (regression in 0.700) #6909

@bmerry

Description

@bmerry
  • Are you reporting a bug, or opening a feature request?

Bug

  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate
    if you try to simplify your case to a minimal repro.
import asyncio

async def foo(protocol: asyncio.StreamReaderProtocol, loop: asyncio.AbstractEventLoop):
    await loop.create_connection(lambda: protocol, 'localhost', 1234)
  • What is the actual behavior/output?
await.py:4: error: Incompatible types in "await" (actual type "Generator[Any, None, Tuple[BaseTransport, BaseProtocol]]", expected type "Awaitable[Any]")
  • What is the behavior/output you expect?

No error.

  • What are the versions of mypy and Python you are using?
    Do you see the same issue after installing mypy from Git master?

0.701. This appears to be a regression between 0.670 (which has no output) and 0.700. I get the error still with mypy master (0.710+dev.95a04913df54d5b1ff78fcb9e7467b798491ec4b).

  • What are the mypy flags you are using? (For example --strict-optional)

No flags

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions