mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-25 08:10:33 +03:00
Release GIL while calling WebPAnimDecoderGetNext
This commit is contained in:
parent
3e04ca5794
commit
469db5114c
|
@ -450,12 +450,16 @@ _anim_decoder_get_next(PyObject *self) {
|
||||||
int timestamp;
|
int timestamp;
|
||||||
PyObject *bytes;
|
PyObject *bytes;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
|
ImagingSectionCookie cookie;
|
||||||
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;
|
WebPAnimDecoderObject *decp = (WebPAnimDecoderObject *)self;
|
||||||
|
|
||||||
|
ImagingSectionEnter(&cookie);
|
||||||
if (!WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)) {
|
if (!WebPAnimDecoderGetNext(decp->dec, &buf, ×tamp)) {
|
||||||
|
ImagingSectionLeave(&cookie);
|
||||||
PyErr_SetString(PyExc_OSError, "failed to read next frame");
|
PyErr_SetString(PyExc_OSError, "failed to read next frame");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
ImagingSectionLeave(&cookie);
|
||||||
|
|
||||||
bytes = PyBytes_FromStringAndSize(
|
bytes = PyBytes_FromStringAndSize(
|
||||||
(char *)buf, decp->info.canvas_width * 4 * decp->info.canvas_height);
|
(char *)buf, decp->info.canvas_width * 4 * decp->info.canvas_height);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user