Skip to content

Fix support for async for comprehensions #2926

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

Merged
merged 5 commits into from
Mar 12, 2017

Conversation

JelleZijlstra
Copy link
Member

Fixes #2924

@gvanrossum gvanrossum merged commit 4a5356c into python:master Mar 12, 2017
@gvanrossum
Copy link
Member

Thanks!

@gvanrossum
Copy link
Member

So I have some bad news.

Running mypy's own tests with these I see two new errors, one in crawl.py and on in crawl2.py. The offending line is

ipaddrs = yield from self.loop.getaddrinfo(host, port)

In the latter it uses await instead.

It's easy to repro manually:

$ mypy test-data/samples/crawl.py
test-data/samples/crawl.py:147: error: 'Union[Tuple[builtins.str, builtins.int], Tuple[builtins.str, builtins.int, builtins.int, builtins.int]]' object is not iterable

@JelleZijlstra
Copy link
Member Author

Oops, I'll look into that tonight.

@JelleZijlstra
Copy link
Member Author

Are you sure the errors are due to this change? I can't currently reproduce it (maybe I'm installing mypy master wrong), but I suspect it's due to python/typeshed#958, which among other things made the return type of loop.getaddrinfo more precise. It was just tuple, but I changed it to a union of the two kinds of tuple it can actually return (for IPv4 and IPv6 addresses I think).

@gvanrossum
Copy link
Member

Yes, sorry. I was confused about which tracker/PR to blame it to.

@JelleZijlstra JelleZijlstra deleted the asyncfor branch May 4, 2017 04:06
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

Successfully merging this pull request may close these issues.

2 participants