Simplify band splitting (#9291)

This commit is contained in:
Hugo van Kemenade 2026-01-02 07:42:46 +02:00 committed by GitHub
commit c9ac097edb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2459,7 +2459,6 @@ _merge(PyObject *self, PyObject *args) {
static PyObject *
_split(ImagingObject *self) {
int fails = 0;
Py_ssize_t i;
PyObject *list;
PyObject *imaging_object;
@ -2473,14 +2472,12 @@ _split(ImagingObject *self) {
for (i = 0; i < self->image->bands; i++) {
imaging_object = PyImagingNew(bands[i]);
if (!imaging_object) {
fails += 1;
Py_DECREF(list);
list = NULL;
break;
}
PyTuple_SET_ITEM(list, i, imaging_object);
}
if (fails) {
Py_DECREF(list);
list = NULL;
}
return list;
}