Make ExitStack, AbstractContextManager and AsyncAbstractContextManager generic in return type of __exit__ (#11048)

This commit is contained in:
David Salvisberg
2024-04-22 16:43:08 +02:00
committed by GitHub
parent b3bfdadb45
commit f274c78fe5
5 changed files with 42 additions and 28 deletions

View File

@@ -14,7 +14,7 @@ class Barrier(threading.Barrier):
self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *ctx: BaseContext
) -> None: ...
class Condition(AbstractContextManager[bool]):
class Condition(AbstractContextManager[bool, None]):
def __init__(self, lock: _LockLike | None = None, *, ctx: BaseContext) -> None: ...
def notify(self, n: int = 1) -> None: ...
def notify_all(self) -> None: ...
@@ -34,7 +34,7 @@ class Event:
def wait(self, timeout: float | None = None) -> bool: ...
# Not part of public API
class SemLock(AbstractContextManager[bool]):
class SemLock(AbstractContextManager[bool, None]):
def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ...
def release(self) -> None: ...
def __exit__(