Closed agronholm closed 1 year ago
The most current typeshed stubs are
def getaddrinfo(
host: bytearray | bytes | str | None,
port: str | int | None,
family: int = ...,
type: int = ...,
proto: int = ...,
flags: int = ...,
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
I think the ones in trio-typing were copied from an earlier version. The bytearray difference doesn't really matter because mypy will promote bytearray to bytes regardless of what the stubs say. The more-specific return type matches upstream. Will land this with a format fix.
Unless trio does something differently, the argument and return types should match those of
socket.getaddrinfo()
. In particular, that function does not accept bytearrays ashost
.