Skip to content

Require custom message for ImagingError_Mismatch() and ImagingError_ModeError() - #10688

Merged
radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:message
Dec 2, 2026
Merged

radarhere merged 2 commits into
python-pillow:mainfrom
radarhere:message

Conversation

@radarhere

Copy link
Copy Markdown
Member

Taken from #9784

For ImagingError_Mismatch() and ImagingError_ModeError()

Pillow/src/_imaging.c

Lines 361 to 371 in deab906

void *
ImagingError_Mismatch(void) {
PyErr_SetString(PyExc_ValueError, "images do not match");
return NULL;
}
void *
ImagingError_ModeError(void) {
PyErr_SetString(PyExc_ValueError, "image has wrong mode");
return NULL;
}

use custom error messages, rather than a generic one.

Also adds some items missed from #10652

Co-authored-by: Aarni Koskela <akx@iki.fi>
@radarhere
radarhere force-pushed the message branch 2 times, most recently from b470f4b to 58ed589 Compare December 2, 2026 01:50
…eError

Co-authored-by: Aarni Koskela <akx@iki.fi>
@radarhere
radarhere merged commit b711b3d into python-pillow:main Dec 2, 2026
85 of 88 checks passed
@radarhere
radarhere deleted the message branch December 2, 2026 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant