One function

interleave_evenly in more-itertools/more-itertools

The author described this change as fix: handle empty interleave_evenly input. It counts as a record because the check below fails on the code as it stood at 5d946b359 and passes on f51a53bfd, with nothing else changed between the two runs.

Fix saved2026-06-30
Sharing licenceMIT · LICENSE
Change size+3 0

What the code was meant to do, written into the code itself as a docstring

Interleave multiple iterables so that their elements are evenly distributed throughout the output sequence. This function requires iterables of known length. Iterables without `__len__()` can be used by manually specifying lengths with *lengths*: Based on Bresenham's algorithm.

The change

3535
3636 dims = len(lengths)
3737
38+ if not dims:
39+ return
40+
3841 # sort iterables by length, descending
3942 lengths_permute = sorted(
4043 range(dims), key=lambda i: lengths[i], reverse=True

The check that tells the two apart

failpass·tests/test_more.py::InterleaveEvenlyTests::test_no_iterables

Check file tests/test_more.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it5d946b3590bfe92f1465c1b9b9830dd434745c84
Broken version dated2026-06-20
Modulemore_itertools.more
Units changedinterleave_evenly
Fingerprint0c9a1108bde9639f
Checked2026-08-17 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in more-itertools/more-itertools