Skip to content

Commit

Permalink
Release python GIL when converting images using matrix operations
Browse files Browse the repository at this point in the history
  • Loading branch information
hmaarrfk committed Jul 5, 2022
1 parent 9ac5a70 commit 96b515b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/_imaging.c
Expand Up @@ -929,6 +929,9 @@ static PyObject *
_convert_matrix(ImagingObject *self, PyObject *args) {
char *mode;
float m[12];
Imaging imOut;
ImagingSectionCookie cookie;

if (!PyArg_ParseTuple(args, "s(ffff)", &mode, m + 0, m + 1, m + 2, m + 3)) {
PyErr_Clear();
if (!PyArg_ParseTuple(
Expand All @@ -950,8 +953,10 @@ _convert_matrix(ImagingObject *self, PyObject *args) {
return NULL;
}
}

return PyImagingNew(ImagingConvertMatrix(self->image, mode, m));
ImagingSectionEnter(&cookie);
imOut = ImagingConvertMatrix(self->image, mode, m);
ImagingSectionLeave(&cookie);
return PyImagingNew(imOut);
}

static PyObject *
Expand Down

0 comments on commit 96b515b

Please sign in to comment.