Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed error type to allow for incremental WebP parsing #5404

Merged
merged 1 commit into from Dec 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions Tests/test_imagefile.py
Expand Up @@ -82,6 +82,19 @@ def test_ico(self):
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()
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