Skip to content

Commit

Permalink
Fix Imaging_Type check in _convert
Browse files Browse the repository at this point in the history
  • Loading branch information
homm committed Sep 18, 2024
1 parent e7bce42 commit b89f791
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b89f791

Please sign in to comment.