Skip to content

Commit

Permalink
Change TemporaryFileWrapper.__exit__ return type to None (#7470)
Browse files Browse the repository at this point in the history
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__.
  • Loading branch information
nbdaaron authored Mar 10, 2022
1 parent 9a1f5fb commit bf2049e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/tempfile.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bf2049e

Please sign in to comment.