Merge pull request #6117 from radarhere/return

This commit is contained in:
Hugo van Kemenade 2022-03-10 22:27:03 +02:00 committed by GitHub
commit 5c931de27f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -306,7 +306,7 @@ class _BLPBaseDecoder(ImageFile.PyDecoder):
self._load()
except struct.error as e:
raise OSError("Truncated BLP file") from e
return 0, 0
return -1, 0
def _read_blp_header(self):
self.fd.seek(4)

View File

@ -231,7 +231,7 @@ class ImageFile(Image.Image):
decoder.setimage(self.im, extents)
if decoder.pulls_fd:
decoder.setfd(self.fp)
status, err_code = decoder.decode(b"")
err_code = decoder.decode(b"")[1]
else:
b = prefix
while True:
@ -664,7 +664,7 @@ class PyDecoder(PyCodec):
:param buffer: A bytes object with the data to be decoded.
:returns: A tuple of ``(bytes consumed, errcode)``.
If finished with decoding return 0 for the bytes consumed.
If finished with decoding return -1 for the bytes consumed.
Err codes are from :data:`.ImageFile.ERRORS`.
"""
raise NotImplementedError()

View File

@ -148,7 +148,7 @@ class MspDecoder(ImageFile.PyDecoder):
self.set_as_raw(img.getvalue(), ("1", 0, 1))
return 0, 0
return -1, 0
Image.register_decoder("MSP", MspDecoder)