mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
improve identity of threading module's Lock and RLock (#12966)
This commit is contained in:
@@ -100,30 +100,22 @@ class Thread:
|
||||
class _DummyThread(Thread):
|
||||
def __init__(self) -> None: ...
|
||||
|
||||
@final
|
||||
class Lock:
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
def locked(self) -> bool: ...
|
||||
def acquire_lock(self, blocking: bool = ..., timeout: float = ...) -> bool: ... # undocumented
|
||||
def release_lock(self) -> None: ... # undocumented
|
||||
def locked_lock(self) -> bool: ... # undocumented
|
||||
# This is actually the function _thread.allocate_lock for <= 3.12
|
||||
Lock = _thread.LockType
|
||||
|
||||
# Python implementation of RLock.
|
||||
@final
|
||||
class _RLock:
|
||||
_count: int
|
||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||
def release(self) -> None: ...
|
||||
__enter__ = acquire
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
|
||||
RLock = _RLock
|
||||
RLock = _thread.RLock # Actually a function at runtime.
|
||||
|
||||
class Condition:
|
||||
def __init__(self, lock: Lock | _RLock | None = None) -> None: ...
|
||||
def __init__(self, lock: Lock | _RLock | RLock | None = None) -> None: ...
|
||||
def __enter__(self) -> bool: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
|
||||
Reference in New Issue
Block a user