Skip to content

Commit 684f8cd

Browse files
author
nightcityblade
committed
Fix DatagramProtocol address type for IPv6
1 parent 1476daf commit 684f8cd

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import asyncio
2+
3+
protocol = asyncio.DatagramProtocol()
4+
protocol.datagram_received(b"", ("127.0.0.1", 80))
5+
protocol.datagram_received(b"", ("::1", 80, 0, 0))

stdlib/asyncio/protocols.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DatagramProtocol(BaseProtocol):
3131
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
3232
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
3333
# See https://github.com/python/typing/issues/566
34-
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
34+
def datagram_received(self, data: bytes, addr: tuple[str | Any, int] | tuple[str, int, int, int]) -> None: ...
3535
def error_received(self, exc: Exception) -> None: ...
3636

3737
class SubprocessProtocol(BaseProtocol):

0 commit comments

Comments
 (0)