Close TarIO file handle on error by radarhere · Pull Request #8846 · python-pillow/Pillow
Tests/test_file_tar.py::test_unexpected_end
/Pillow/Tests/test_file_tar.py:38: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/pytest-of-pillow/pytest-0/test_unexpected_end0/temp.tar'>
with pytest.raises(OSError, match="unexpected end of tar file"):
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
Tests/test_file_tar.py::test_cannot_find_subfile
/Pillow/Tests/test_file_tar.py:44: ResourceWarning: unclosed file <_io.BufferedReader name='Tests/images/hopper.tar'>
with pytest.raises(OSError, match="cannot find subfile"):
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
This fixes that.