Skip to content

Commit 4430ea1

Browse files
[asyncio.protocols] Fix DatagramProtocol address type for IPv6 (#16116)
1 parent 1b11667 commit 4430ea1

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

stdlib/asyncio/protocols.pyi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ class BufferedProtocol(BaseProtocol):
2727
class DatagramProtocol(BaseProtocol):
2828
__slots__ = ()
2929
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override]
30-
# addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK.
31-
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
32-
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
33-
# See https://github.com/python/typing/issues/566
34-
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
30+
# addr is a tuple[str, int] for IPv4 or tuple[str, int, int, int] for IPv6.
31+
# It can also be a tuple[int, int] for unusual protocols like socket.AF_NETLINK.
32+
def datagram_received(self, data: bytes, addr: tuple[Any, ...]) -> None: ...
3533
def error_received(self, exc: Exception) -> None: ...
3634

3735
class SubprocessProtocol(BaseProtocol):

0 commit comments

Comments
 (0)