Skip to content

Commit

Permalink
Changed failure to create decoder to OSError for Parser
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 14, 2021
1 parent 45003b7 commit c081654
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Tests/test_imagefile.py
Expand Up @@ -82,6 +82,17 @@ def test_ico(self):
p.feed(data)
assert (48, 48) == p.image.size

def test_incremental_webp(self):
with ImageFile.Parser() as p:
with open("Tests/images/hopper.webp", "rb") as f:
p.feed(f.read(1024))

# Check that insufficient data was given in the first feed
assert not p.image

p.feed(f.read())
assert (128, 128) == p.image.size

@skip_unless_feature("zlib")
def test_safeblock(self):
im1 = hopper()
Expand Down
2 changes: 1 addition & 1 deletion src/_webp.c
Expand Up @@ -395,7 +395,7 @@ _anim_decoder_new(PyObject *self, PyObject *args) {
}
PyObject_Del(decp);
}
PyErr_SetString(PyExc_RuntimeError, "could not create decoder object");
PyErr_SetString(PyExc_OSError, "could not create decoder object");
return NULL;
}

Expand Down

0 comments on commit c081654

Please sign in to comment.