Skip to content

Return 0 or -1 from ImagingSplit(), rather than number of bands - #9988

Merged
hugovk merged 3 commits into
python-pillow:mainfrom
radarhere:split
Sep 15, 2026
Merged

hugovk merged 3 commits into
python-pillow:mainfrom
radarhere:split

Conversation

@radarhere

Copy link
Copy Markdown
Member

The only time that ImagingSplit() is called, the result is only checked for success or failure.

Pillow/src/_imaging.c

Lines 2507 to 2509 in 0253ef0

if (!ImagingSplit(self->image, bands)) {
return NULL;
}

There's no reason it needs to return the number of bands.

return imIn->bands;

So let's return 0 for success and -1 for failure instead.

Comment thread src/libImaging/Bands.c
radarhere and others added 2 commits September 14, 2026 11:01
Co-authored-by: Aarni Koskela <akx@iki.fi>
@hugovk
hugovk merged commit fb974c6 into python-pillow:main Sep 15, 2026
56 of 57 checks passed
@radarhere
radarhere deleted the split branch September 15, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants