diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 3e348e8c3..87bcaa211 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -45,20 +45,20 @@ else: ) -> None: ... class Lock(_ContextManagerMixin): - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 10): def __init__(self) -> None: ... else: - def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ... def locked(self) -> bool: ... async def acquire(self) -> Literal[True]: ... def release(self) -> None: ... class Event: - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 10): def __init__(self) -> None: ... else: - def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ... def is_set(self) -> bool: ... def set(self) -> None: ... @@ -66,10 +66,10 @@ class Event: async def wait(self) -> Literal[True]: ... class Condition(_ContextManagerMixin): - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 10): def __init__(self, lock: Lock | None = None) -> None: ... else: - def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = None) -> None: ... def locked(self) -> bool: ... async def acquire(self) -> Literal[True]: ... @@ -82,10 +82,10 @@ class Condition(_ContextManagerMixin): class Semaphore(_ContextManagerMixin): _value: int _waiters: deque[Future[Any]] - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 10): def __init__(self, value: int = 1) -> None: ... else: - def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = None) -> None: ... def locked(self) -> bool: ... async def acquire(self) -> Literal[True]: ... diff --git a/stdlib/asyncio/queues.pyi b/stdlib/asyncio/queues.pyi index 76273be75..f56a09524 100644 --- a/stdlib/asyncio/queues.pyi +++ b/stdlib/asyncio/queues.pyi @@ -13,10 +13,10 @@ class QueueFull(Exception): ... _T = TypeVar("_T") class Queue(Generic[_T]): - if sys.version_info >= (3, 11): + if sys.version_info >= (3, 10): def __init__(self, maxsize: int = 0) -> None: ... else: - def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = None) -> None: ... def _init(self, maxsize: int) -> None: ... def _get(self) -> _T: ... diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index 35e5e7c72..7f53e7f10 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -65,6 +65,22 @@ tempfile.SpooledTemporaryFile.readable tempfile.SpooledTemporaryFile.seekable tempfile.SpooledTemporaryFile.writable +# The "loop" argument exists at runtime, +# but raises TypeError if you try to provide any value for it +asyncio.BoundedSemaphore.__init__ +asyncio.Condition.__init__ +asyncio.Event.__init__ +asyncio.Lock.__init__ +asyncio.Queue.__init__ +asyncio.Semaphore.__init__ +asyncio.locks.BoundedSemaphore.__init__ +asyncio.locks.Semaphore.__init__ +asyncio.locks.Condition.__init__ +asyncio.locks.Event.__init__ +asyncio.locks.Lock.__init__ +asyncio.locks.Semaphore.__init__ +asyncio.queues.Queue.__init__ + # Exists at runtime, but missing from stubs _collections_abc.AsyncIterable.__class_getitem__ _collections_abc.Awaitable.__class_getitem__