Skip to content

Add IPv6 support to socketserver.BaseServer #10671

Open
@DiegoBaldassarMilleuno

Description

@DiegoBaldassarMilleuno

The constructors for the *Server classes in socketserver.pyi should accept as the value for the server_address parameter a 4-tuple specifying an IPv6 socket.

The typing is currently tuple[str, int] (which is the type for AF_INET sockets), but the constructors can also take tuple[str, int, int, int] (for AF_INET6); as such, it makes sense to update the type to tuple[str, int] | tuple[str, int, int, int], matching the sockaddr (last) field from the return value of socket.getaddrinfo().

The only usage of server_address in the file is as an argument to socket.socket.bind(), so it could possibly make sense to change the type to _socket._Address | bytes.

Definitions:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions