From b11e2e37c6fde5ce48b5ba79a8f455ce0efebe17 Mon Sep 17 00:00:00 2001 From: gandalf3 Date: Sat, 21 Jan 2023 13:00:44 -0800 Subject: [PATCH] create_datagram_endpoint expects a str when family=AF_UNIX (#9574) Since python 3.7, asyncio.loop.create_datagram_endpoint expects the arguments `local_addr` and `remote_addr` to be `str` or `None` when the argument family=`socket.AF_UNIX` and the argument `sock` is `None` or also a unix socket. --- stdlib/asyncio/base_events.pyi | 8 ++++---- stdlib/asyncio/events.pyi | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 6ff3c2c9f..8af829d4f 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -342,8 +342,8 @@ class BaseEventLoop(AbstractEventLoop): async def create_datagram_endpoint( # type: ignore[override] self, protocol_factory: Callable[[], _ProtocolT], - local_addr: tuple[str, int] | None = None, - remote_addr: tuple[str, int] | None = None, + local_addr: tuple[str, int] | str | None = None, + remote_addr: tuple[str, int] | str | None = None, *, family: int = 0, proto: int = 0, @@ -356,8 +356,8 @@ class BaseEventLoop(AbstractEventLoop): async def create_datagram_endpoint( self, protocol_factory: Callable[[], _ProtocolT], - local_addr: tuple[str, int] | None = ..., - remote_addr: tuple[str, int] | None = ..., + local_addr: tuple[str, int] | str | None = ..., + remote_addr: tuple[str, int] | str | None = ..., *, family: int = ..., proto: int = ..., diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index fd8213f55..aa2098281 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -495,8 +495,8 @@ class AbstractEventLoop: async def create_datagram_endpoint( self, protocol_factory: Callable[[], _ProtocolT], - local_addr: tuple[str, int] | None = None, - remote_addr: tuple[str, int] | None = None, + local_addr: tuple[str, int] | str | None = None, + remote_addr: tuple[str, int] | str | None = None, *, family: int = 0, proto: int = 0,