Skip to content

drop union return type from getaddrinfo #1002

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 3 commits into from
Mar 14, 2017

Conversation

JelleZijlstra
Copy link
Member

As discussed in #958. I added references to the related mypy issue, python/mypy#2509.

def getaddrinfo(
host: Optional[str], port: Union[str, int, None], family: int = ...,
socktype: int = ..., proto: int = ...,
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any]]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should rather be Tuple[Any, ...].

def getaddrinfo(self, host: str, port: int, *,
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]]: ...
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any]]]]: ...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

def getaddrinfo(
host: Optional[str], port: Union[str, int, None], family: int = ...,
socktype: int = ..., proto: int = ...,
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any]]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@gvanrossum
Copy link
Member

Still breaks...

$ mypy test-data/samples/crawl.py
test-data/samples/crawl.py:147: error: Need more than 1 value to unpack (2 expected)

@ambv
Copy link
Contributor

ambv commented Mar 14, 2017

Still breaks...

With Tuple[Any, ...] it won't.

sorry for not testing properly :(
@gvanrossum
Copy link
Member

Try again with three dots. Then sit back, relax, wait three minutes, run the test against crawl.py and crawl2.py, then push. :-)

I tested it
@gvanrossum gvanrossum merged commit 48b1962 into python:master Mar 14, 2017
@JelleZijlstra JelleZijlstra deleted the nounions branch March 14, 2017 18:45
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.

3 participants