Skip to content

Commit

Permalink
Merge pull request #6117 from radarhere/return
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Mar 10, 2022
2 parents 0639609 + e87432b commit 5c931de
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/PIL/BlpImagePlugin.py
Expand Up @@ -306,7 +306,7 @@ def decode(self, buffer):
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)
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/ImageFile.py
Expand Up @@ -231,7 +231,7 @@ def load(self):
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:
Expand Down Expand Up @@ -664,7 +664,7 @@ def decode(self, buffer):
: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()
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/MspImagePlugin.py
Expand Up @@ -148,7 +148,7 @@ def decode(self, buffer):

self.set_as_raw(img.getvalue(), ("1", 0, 1))

return 0, 0
return -1, 0


Image.register_decoder("MSP", MspDecoder)
Expand Down

0 comments on commit 5c931de

Please sign in to comment.