Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correct asyncio.locks._ContextManagerMixin and _ContextManager types #7124

Merged
merged 6 commits into from
Feb 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions stdlib/asyncio/locks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ _T = TypeVar("_T")

if sys.version_info >= (3, 9):
class _ContextManagerMixin:
def __init__(self, lock: Lock | Semaphore) -> None: ...
async def __aenter__(self) -> None: ...
async def __aexit__(
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
Expand All @@ -20,14 +19,13 @@ if sys.version_info >= (3, 9):
else:
class _ContextManager:
def __init__(self, lock: Lock | Semaphore) -> None: ...
def __enter__(self) -> object: ...
def __enter__(self) -> None: ...
def __exit__(self, *args: Any) -> None: ...

class _ContextManagerMixin:
def __init__(self, lock: Lock | Semaphore) -> None: ...
Akuli marked this conversation as resolved.
Show resolved Hide resolved
# Apparently this exists to *prohibit* use as a context manager.
def __enter__(self) -> object: ...
def __exit__(self, *args: Any) -> None: ...
# def __enter__(self) -> NoReturn: ... see: https://github.com/python/typing/issues/1043
# def __exit__(self, *args: Any) -> None: ...
def __iter__(self) -> Generator[Any, None, _ContextManager]: ...
def __await__(self) -> Generator[Any, None, _ContextManager]: ...
async def __aenter__(self) -> None: ...
Expand Down