mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 10:16:17 +03:00
Merge pull request #7782 from evanmiller/webp-get-next-without-gil
Release GIL while calling `WebPAnimDecoderGetNext`
This commit is contained in:
commit
f8a54b78a3
|
@ -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.
|
||||
|
|
|
@ -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, ×tamp)) {
|
||||
ImagingSectionEnter(&cookie);
|
||||
ok = WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp);
|
||||
ImagingSectionLeave(&cookie);
|
||||
if (!ok) {
|
||||
PyErr_SetString(PyExc_OSError, "failed to read next frame");
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user