mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 08:14:10 +03:00
Merge pull request #5404 from radarhere/feed
Changed error type to allow for incremental WebP parsing
This commit is contained in:
commit
d8f2fb50a4
|
@ -82,6 +82,19 @@ class TestImageFile:
|
||||||
p.feed(data)
|
p.feed(data)
|
||||||
assert (48, 48) == p.image.size
|
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")
|
@skip_unless_feature("zlib")
|
||||||
def test_safeblock(self):
|
def test_safeblock(self):
|
||||||
im1 = hopper()
|
im1 = hopper()
|
||||||
|
|
|
@ -396,7 +396,7 @@ _anim_decoder_new(PyObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
PyObject_Del(decp);
|
PyObject_Del(decp);
|
||||||
}
|
}
|
||||||
PyErr_SetString(PyExc_RuntimeError, "could not create decoder object");
|
PyErr_SetString(PyExc_OSError, "could not create decoder object");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user