diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index 22dcac6f46ca..9aaaa646cf3a 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -104,6 +104,10 @@ codecs.replace_errors # Runtime incorrectly has `self` codecs.strict_errors # Runtime incorrectly has `self` codecs.xmlcharrefreplace_errors # Runtime incorrectly has `self` +# The concrete Unix event loop accepts this Python 3.13 parameter, but the +# abstract runtime signature has not been updated. +asyncio.events.AbstractEventLoop.create_unix_server # parameter `cleanup_socket` + # These multiprocessing proxy methods have *args, **kwargs signatures at runtime, # But have more precise (accurate) signatures in the stub multiprocessing.managers._BaseDictProxy.__iter__ diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index b76fa29cd7d2..b2fa67b07028 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -138,6 +138,10 @@ codecs.replace_errors # Runtime incorrectly has `self` codecs.strict_errors # Runtime incorrectly has `self` codecs.xmlcharrefreplace_errors # Runtime incorrectly has `self` +# The concrete Unix event loop accepts this Python 3.13 parameter, but the +# abstract runtime signature has not been updated. +asyncio.events.AbstractEventLoop.create_unix_server # parameter `cleanup_socket` + # These multiprocessing proxy methods have *args, **kwargs signatures at runtime, # But have more precise (accurate) signatures in the stub multiprocessing.managers._BaseDictProxy.__iter__ diff --git a/stdlib/@tests/stubtest_allowlists/py315.txt b/stdlib/@tests/stubtest_allowlists/py315.txt index 7354dac4dc90..55b5ca924254 100644 --- a/stdlib/@tests/stubtest_allowlists/py315.txt +++ b/stdlib/@tests/stubtest_allowlists/py315.txt @@ -138,6 +138,10 @@ codecs.replace_errors # Runtime incorrectly has `self` codecs.strict_errors # Runtime incorrectly has `self` codecs.xmlcharrefreplace_errors # Runtime incorrectly has `self` +# The concrete Unix event loop accepts this Python 3.13 parameter, but the +# abstract runtime signature has not been updated. +asyncio.events.AbstractEventLoop.create_unix_server # parameter `cleanup_socket` + # These multiprocessing proxy methods have *args, **kwargs signatures at runtime, # but have more precise (accurate) signatures in the stub. multiprocessing.managers._BaseDictProxy.__iter__ diff --git a/stdlib/@tests/test_cases/asyncio/check_events-py313.py b/stdlib/@tests/test_cases/asyncio/check_events-py313.py new file mode 100644 index 000000000000..e381ddd194d1 --- /dev/null +++ b/stdlib/@tests/test_cases/asyncio/check_events-py313.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +import asyncio +import sys +from collections.abc import Callable + +if sys.version_info >= (3, 13): + + async def check_abstract_event_loop_create_unix_server_cleanup_socket( + loop: asyncio.AbstractEventLoop, protocol_factory: Callable[[], asyncio.Protocol] + ) -> None: + await loop.create_unix_server(protocol_factory, cleanup_socket=False) diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 5e561b09cd46..f31cca6d6364 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -422,18 +422,33 @@ class AbstractEventLoop: ssl_handshake_timeout: float | None = None, ssl_shutdown_timeout: float | None = None, ) -> Transport | None: ... - async def create_unix_server( - self, - protocol_factory: _ProtocolFactory, - path: StrPath | None = None, - *, - sock: socket | None = None, - backlog: int = 100, - ssl: _SSLContext = None, - ssl_handshake_timeout: float | None = None, - ssl_shutdown_timeout: float | None = None, - start_serving: bool = True, - ) -> Server: ... + if sys.version_info >= (3, 13): + async def create_unix_server( + self, + protocol_factory: _ProtocolFactory, + path: StrPath | None = None, + *, + sock: socket | None = None, + backlog: int = 100, + ssl: _SSLContext = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, + start_serving: bool = True, + cleanup_socket: bool = True, + ) -> Server: ... + else: + async def create_unix_server( + self, + protocol_factory: _ProtocolFactory, + path: StrPath | None = None, + *, + sock: socket | None = None, + backlog: int = 100, + ssl: _SSLContext = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, + start_serving: bool = True, + ) -> Server: ... else: @abstractmethod async def start_tls(