mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Fix Imaging_Type check in _convert
This commit is contained in:
parent
50dd94664b
commit
3a16a350cc
|
@ -896,17 +896,12 @@ _convert(ImagingObject *self, PyObject *args) {
|
||||||
int dither = 0;
|
int dither = 0;
|
||||||
ImagingObject *paletteimage = NULL;
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (paletteimage != 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) {
|
if (paletteimage->image->palette == NULL) {
|
||||||
PyErr_SetString(PyExc_ValueError, "null palette");
|
PyErr_SetString(PyExc_ValueError, "null palette");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user