Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bmerry opened this issue May 29, 2019 · 3 comments

Comments

@bmerry
Copy link
Contributor

bmerry commented May 29, 2019

  • 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

@bmerry
Copy link
Contributor Author

bmerry commented May 29, 2019

I also get a similar error from AbstractEventLoop.create_server, but not from all asyncio coroutines e.g. Event.wait is fine.

@ilevkivskyi
Copy link
Member

I think this is a duplicate of #6802. Could you please double-check that PR #6821 fixes your issue as well?

@bmerry
Copy link
Contributor Author

bmerry commented Jun 2, 2019

Thanks, I can confirm that PR #6821 fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants