contextlib: Remove explicit base class from ExitStack (#7963)

Fixes #7961
This commit is contained in:
Jelle Zijlstra
2022-05-27 09:19:18 -07:00
committed by GitHub
parent 2d2b34c1ee
commit c35ec8ba89
2 changed files with 20 additions and 2 deletions

View File

@@ -163,7 +163,7 @@ class _RedirectStream(AbstractContextManager[_T_io]):
class redirect_stdout(_RedirectStream[_T_io]): ...
class redirect_stderr(_RedirectStream[_T_io]): ...
class ExitStack(AbstractContextManager[ExitStack]):
class ExitStack:
def __init__(self) -> None: ...
def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
def push(self, exit: _CM_EF) -> _CM_EF: ...
@@ -179,7 +179,7 @@ if sys.version_info >= (3, 7):
_ExitCoroFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], Awaitable[bool]]
_ACM_EF = TypeVar("_ACM_EF", bound=AbstractAsyncContextManager[Any] | _ExitCoroFunc)
class AsyncExitStack(AbstractAsyncContextManager[AsyncExitStack]):
class AsyncExitStack:
def __init__(self) -> None: ...
def enter_context(self, cm: AbstractContextManager[_T]) -> _T: ...
async def enter_async_context(self, cm: AbstractAsyncContextManager[_T]) -> _T: ...