diff --git a/stdlib/2and3/contextlib.pyi b/stdlib/2and3/contextlib.pyi index aaad35c24..dec1b411d 100644 --- a/stdlib/2and3/contextlib.pyi +++ b/stdlib/2and3/contextlib.pyi @@ -2,7 +2,7 @@ from typing import ( Any, Callable, Generator, IO, Iterable, Iterator, Optional, Type, - Generic, TypeVar + Generic, TypeVar, overload ) from types import TracebackType import sys @@ -91,3 +91,9 @@ if sys.version_info >= (3, 7): def pop_all(self: _S) -> _S: ... def aclose(self) -> Awaitable[None]: ... def __aenter__(self: _S) -> Awaitable[_S]: ... + +if sys.version_info >= (3, 7): + @overload + def nullcontext(enter_result: _T) -> ContextManager[_T]: ... + @overload + def nullcontext() -> ContextManager[None]: ...