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
| 35 | 35 | ||
| 36 | 36 | dims = len(lengths) | |
| 37 | 37 | ||
| 38 | + | if not dims: | |
| 39 | + | return | |
| 40 | + | ||
| 38 | 41 | # sort iterables by length, descending | |
| 39 | 42 | lengths_permute = sorted( | |
| 40 | 43 | range(dims), key=lambda i: lengths[i], reverse=True |
The check that tells the two apart
fail→pass·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
- 2026-07-19chunked
- 2026-07-03sliced
- 2026-06-30tail
- 2026-04-01windowed
- 2026-01-02nth_combination_with_replacement
- 2026-01-02nth_permutation