Skip to content

Commit b89f791

Browse files
committed
Fix Imaging_Type check in _convert
1 parent e7bce42 commit b89f791

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

src/_imaging.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -896,17 +896,12 @@ _convert(ImagingObject *self, PyObject *args) {
896896
int dither = 0;
897897
ImagingObject *paletteimage = NULL;
898898

899-
if (!PyArg_ParseTuple(args, "s|iO", &mode, &dither, &paletteimage)) {
899+
if (!PyArg_ParseTuple(
900+
args, "s|iO!", &mode, &dither, &Imaging_Type, &paletteimage
901+
)) {
900902
return NULL;
901903
}
902904
if (paletteimage != NULL) {
903-
if (!PyImaging_Check(paletteimage)) {
904-
PyObject_Print((PyObject *)paletteimage, stderr, 0);
905-
PyErr_SetString(
906-
PyExc_ValueError, "palette argument must be image with mode 'P'"
907-
);
908-
return NULL;
909-
}
910905
if (paletteimage->image->palette == NULL) {
911906
PyErr_SetString(PyExc_ValueError, "null palette");
912907
return NULL;

0 commit comments

Comments
 (0)