Add filename to OSError.

This commit is contained in:
kratel 2021-05-13 23:20:12 -04:00
parent 186145e5a0
commit c3373e928c

View File

@ -240,7 +240,8 @@ class ImageFile(Image.Image):
if LOAD_TRUNCATED_IMAGES:
break
else:
raise OSError("image file is truncated") from e
raise OSError(None, "image file is truncated",
self.filename) from e
if not s: # truncated jpeg
if LOAD_TRUNCATED_IMAGES: