Change TemporaryFileWrapper.__exit__ return type to None (#7470)

For context we found this from quora/pyanalyze#496, which makes pyanalyze stricter about context managers that may swallow exceptions. tempfile._TemporaryFileWrapper.__exit__ returns whatever its underlying file returns (https://github.com/python/cpython/blob/3.6/Lib/tempfile.py#L502), and file objects don't tend to return anything from __exit__.
This commit is contained in:
Aaron Kau
2022-03-09 19:34:24 -08:00
committed by GitHub
parent 9a1f5fb06c
commit bf2049ef18

View File

@@ -185,7 +185,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]):
delete: bool
def __init__(self, file: IO[AnyStr], name: str, delete: bool = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> bool | None: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def close(self) -> None: ...
# These methods don't exist directly on this object, but