One function
tail in more-itertools/more-itertools
The author described this change as “Raise for negative tail sizes on sized iterables”. It counts as a record because the check below fails on the code as it stood at 5d946b359 and passes on d64a7d697, 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
Return an iterator over the last *n* items of *iterable*.
The change
| 6 | 6 | ['E', 'F', 'G'] | |
| 7 | 7 | ||
| 8 | 8 | """ | |
| 9 | + | if n < 0: | |
| 10 | + | raise ValueError('n must be at least 0') | |
| 11 | + | ||
| 9 | 12 | try: | |
| 10 | 13 | size = len(iterable) | |
| 11 | 14 | except TypeError: |
The check that tells the two apart
fail→pass·tests/test_recipes.py::TailTests::test_sized_negative
Check file tests/test_recipes.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.recipes
Units changedtail
Fingerprintb0c3bc65d0766c4c
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-30interleave_evenly
- 2026-04-01windowed
- 2026-01-02nth_combination_with_replacement
- 2026-01-02nth_permutation