Skip to content

Commit 48b1962

Browse files
JelleZijlstragvanrossum
authored andcommitted
drop union return type from getaddrinfo (#1002)
1 parent 11350ed commit 48b1962

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

stdlib/2/socket.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,12 @@ def create_connection(address: Tuple[str, int],
335335
source_address: Tuple[str, int] = ...) -> socket: ...
336336

337337
# the 5th tuple item is an address
338+
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
339+
# https://github.com/python/mypy/issues/2509
338340
def getaddrinfo(
339341
host: Optional[str], port: Union[str, int, None], family: int = ...,
340342
socktype: int = ..., proto: int = ...,
341-
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
343+
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]:
342344
...
343345

344346
def getfqdn(name: str = ...) -> str: ...

stdlib/3.4/asyncio/events.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ class AbstractEventLoop(metaclass=ABCMeta):
9393
# Network I/O methods returning Futures.
9494
@abstractmethod
9595
@coroutine
96+
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
97+
# https://github.com/python/mypy/issues/2509
9698
def getaddrinfo(self, host: str, port: int, *,
97-
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]]]]]: ...
99+
family: int = ..., type: int = ..., proto: int = ..., flags: int = ...) -> Generator[Any, None, List[Tuple[int, int, int, str, Tuple[Any, ...]]]]: ...
98100
@abstractmethod
99101
@coroutine
100102
def getnameinfo(self, sockaddr: tuple, flags: int = ...) -> Generator[Any, None, Tuple[str, int]]: ...

stdlib/3/socket.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,12 @@ def create_connection(address: Tuple[str, int],
331331
source_address: Tuple[str, int] = ...) -> socket: ...
332332

333333
# the 5th tuple item is an address
334+
# TODO the "Tuple[Any, ...]" should be "Union[Tuple[str, int], Tuple[str, int, int, int]]" but that triggers
335+
# https://github.com/python/mypy/issues/2509
334336
def getaddrinfo(
335337
host: Optional[str], port: Union[str, int, None], family: int = ...,
336338
socktype: int = ..., proto: int = ...,
337-
flags: int = ...) -> List[Tuple[int, int, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]:
339+
flags: int = ...) -> List[Tuple[int, int, int, str, Tuple[Any, ...]]]:
338340
...
339341

340342
def getfqdn(name: str = ...) -> str: ...

0 commit comments

Comments
 (0)