OSError caused by decode error should use string argument to be in line with rest of module

This commit is contained in:
Harm.van.den.brand@alliander.com 2025-01-02 16:47:24 +01:00
parent 22d50fd2c1
commit 036db2da87
2 changed files with 3 additions and 2 deletions

View File

@ -1146,7 +1146,7 @@ class TestFileLibTiff(LibTiffTestCase):
im.load()
# Assert that the error code is IMAGING_CODEC_MEMORY
assert str(e.value) == "-9"
assert str(e.value) == "decoder error -9"
@pytest.mark.parametrize("compression", ("tiff_adobe_deflate", "jpeg"))
def test_save_multistrip(self, compression: str, tmp_path: Path) -> None:

View File

@ -1406,7 +1406,8 @@ class TiffImageFile(ImageFile.ImageFile):
self.fp = None # might be shared
if err < 0:
raise OSError(err)
msg = f"decoder error {err}"
raise OSError(msg)
return Image.Image.load(self)