Changed failure to create decoder to OSError for Parser

This commit is contained in:
Andrew Murray 2021-04-14 20:01:56 +10:00
parent 45003b78ed
commit 35107e9637
2 changed files with 14 additions and 1 deletions

View File

@ -82,6 +82,19 @@ class TestImageFile:
p.feed(data)
assert (48, 48) == p.image.size
@skip_unless_feature("webp")
@skip_unless_feature("webp_anim")
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()

View File

@ -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;
}