From 3a16a350cc0239637dafe9814da29094c06ee997 Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Tue, 17 Sep 2024 16:24:23 +0200 Subject: [PATCH] Fix Imaging_Type check in _convert --- src/_imaging.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/_imaging.c b/src/_imaging.c index a1bd8b2ad..172d46c55 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -896,17 +896,12 @@ _convert(ImagingObject *self, PyObject *args) { int dither = 0; ImagingObject *paletteimage = NULL; - if (!PyArg_ParseTuple(args, "s|iO", &mode, &dither, &paletteimage)) { + if (!PyArg_ParseTuple( + args, "s|iO!", &mode, &dither, &Imaging_Type, &paletteimage + )) { return NULL; } if (paletteimage != NULL) { - if (!PyImaging_Check(paletteimage)) { - PyObject_Print((PyObject *)paletteimage, stderr, 0); - PyErr_SetString( - PyExc_ValueError, "palette argument must be image with mode 'P'" - ); - return NULL; - } if (paletteimage->image->palette == NULL) { PyErr_SetString(PyExc_ValueError, "null palette"); return NULL;