diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index 480546fb9..21f640a17 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -53,6 +53,8 @@ if sys.version_info >= (3,): class ContextDecorator: def __call__(self, func: Callable[..., None]) -> Callable[..., ContextManager[None]]: ... + _U = TypeVar('_U', bound='ExitStack') + class ExitStack(ContextManager[ExitStack]): def __init__(self) -> None: ... def enter_context(self, cm: ContextManager[_T]) -> _T: ... @@ -61,3 +63,4 @@ if sys.version_info >= (3,): *args: Any, **kwds: Any) -> Callable[..., None]: ... def pop_all(self) -> ExitStack: ... def close(self) -> None: ... + def __enter__(self: _U) -> _U: ...