Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/releasenotes/10.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ Portable FloatMap (PFM) images

Support has been added for reading and writing grayscale (Pf format)
Portable FloatMap (PFM) files containing ``F`` data.

Release GIL when fetching WebP frames
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Python's Global Interpreter Lock is now released when fetching WebP frames from
the libwebp decoder.
7 changes: 6 additions & 1 deletion src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,16 @@ PyObject *
_anim_decoder_get_next(PyObject *self) {
uint8_t *buf;
int timestamp;
int ok;
PyObject *bytes;
PyObject *ret;
ImagingSectionCookie cookie;
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;

if (!WebPAnimDecoderGetNext(decp->dec, &buf, &timestamp)) {
ImagingSectionEnter(&cookie);
ok = WebPAnimDecoderGetNext(decp->dec, &buf, &timestamp);
ImagingSectionLeave(&cookie);
if (!ok) {
PyErr_SetString(PyExc_OSError, "failed to read next frame");
return NULL;
}
Expand Down