Skip to content

Commit 4e67419

Browse files
authored
most asyncio lock methods always return True (#7122)
1 parent 4d21d5a commit 4e67419

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stdlib/asyncio/locks.pyi

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import sys
22
from collections import deque
33
from types import TracebackType
44
from typing import Any, Callable, Generator, TypeVar
5+
from typing_extensions import Literal
56

67
from .events import AbstractEventLoop
78
from .futures import Future
@@ -37,22 +38,22 @@ else:
3738
class Lock(_ContextManagerMixin):
3839
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
3940
def locked(self) -> bool: ...
40-
async def acquire(self) -> bool: ...
41+
async def acquire(self) -> Literal[True]: ...
4142
def release(self) -> None: ...
4243

4344
class Event:
4445
def __init__(self, *, loop: AbstractEventLoop | None = ...) -> None: ...
4546
def is_set(self) -> bool: ...
4647
def set(self) -> None: ...
4748
def clear(self) -> None: ...
48-
async def wait(self) -> bool: ...
49+
async def wait(self) -> Literal[True]: ...
4950

5051
class Condition(_ContextManagerMixin):
5152
def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
5253
def locked(self) -> bool: ...
53-
async def acquire(self) -> bool: ...
54+
async def acquire(self) -> Literal[True]: ...
5455
def release(self) -> None: ...
55-
async def wait(self) -> bool: ...
56+
async def wait(self) -> Literal[True]: ...
5657
async def wait_for(self, predicate: Callable[[], _T]) -> _T: ...
5758
def notify(self, n: int = ...) -> None: ...
5859
def notify_all(self) -> None: ...
@@ -62,7 +63,7 @@ class Semaphore(_ContextManagerMixin):
6263
_waiters: deque[Future[Any]]
6364
def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ...
6465
def locked(self) -> bool: ...
65-
async def acquire(self) -> bool: ...
66+
async def acquire(self) -> Literal[True]: ...
6667
def release(self) -> None: ...
6768
def _wake_up_next(self) -> None: ...
6869

0 commit comments

Comments
 (0)