diff --git a/src/_imaging.c b/src/_imaging.c index cc782698245..30e6b6c14e0 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -1822,7 +1822,7 @@ _quantize(ImagingObject *self, PyObject *args) { } static PyObject * -_putpalette(ImagingObject *self, PyObject *args) { +_putpalette_impl(ImagingObject *self, PyObject *args) { ImagingShuffler unpack; int bits; @@ -1887,6 +1887,15 @@ _putpalette(ImagingObject *self, PyObject *args) { Py_RETURN_NONE; } +static PyObject * +_putpalette(ImagingObject *self, PyObject *args) { + PyObject *result; + Py_BEGIN_CRITICAL_SECTION(self); + result = _putpalette_impl(self, args); + Py_END_CRITICAL_SECTION(); + return result; +} + static PyObject * _putpalettealpha(ImagingObject *self, PyObject *args) { int index;