stdlib: Improve a bunch of __(a)exit__ methods (#7571)

This commit is contained in:
Alex Waygood
2022-04-01 07:05:25 +01:00
committed by GitHub
parent 85f060b26d
commit da3e69d093
20 changed files with 47 additions and 28 deletions

View File

@@ -217,9 +217,9 @@ if sys.version_info >= (3, 10):
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Any) -> None: ...
def __exit__(self, *exctype: object) -> None: ...
async def __aenter__(self) -> _T: ...
async def __aexit__(self, *exctype: Any) -> None: ...
async def __aexit__(self, *exctype: object) -> None: ...
elif sys.version_info >= (3, 7):
class nullcontext(AbstractContextManager[_T]):
@@ -229,7 +229,7 @@ elif sys.version_info >= (3, 7):
@overload
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
def __enter__(self) -> _T: ...
def __exit__(self, *exctype: Any) -> None: ...
def __exit__(self, *exctype: object) -> None: ...
if sys.version_info >= (3, 11):
_T_fd_or_any_path = TypeVar("_T_fd_or_any_path", bound=int | StrOrBytesPath)