One function
daterange in mahmoud/boltons
The author described this change as “Fix bug in implementation of `timeutils.daterange`”. It counts as a record because the check below fails on the code as it stood at d931428f0 and passes on 139d5dcd3, with nothing else changed between the two runs.
Projectmahmoud/boltons
Fix saved2018-10-11
Sharing licenceBSD-2-Clause · LICENSE
Change size+1 −1
What the code was meant to do, written into the code itself as a docstring
In the spirit of :func:`range` and :func:`xrange`, the `daterange` generator that yields a sequence of :class:`~datetime.date` objects, starting at *start*, incrementing by *step*, until *stop* is reached. When *inclusive* is True, the final date may be *stop*, **if** *step* falls evenly on it. By default, *step* is one day. See details below for many more details. Args: start (datetime.date): The starting date The first value in the sequence. stop (datetime.date): The stopping date. By default not included in return. Can be `None` to yield an infinite sequence. step (int): The value to increment *start* by to reach *stop*. Can be an :class:`int` number of days, a :class:`datetime.timedelta`, or a :class:`tuple` of integers, `(year, month, day)`. Positive and negative *step* values are supported. inclusive (bool): Whether or not the *stop* date can be returned. *stop* is only returned when a *step* falls evenly on it. *Be careful when using stop=None, as this will yield an infinite sequence of dates.*
The change
| 68 | 68 | ' (year, month, day), not: %r' % step) | |
| 69 | 69 | ||
| 70 | 70 | if stop is None: | |
| 71 | - | finished = lambda t: False | |
| 71 | + | finished = lambda now, stop: False | |
| 72 | 72 | elif start < stop: | |
| 73 | 73 | finished = operator.gt if inclusive else operator.ge | |
| 74 | 74 | else: |
The check that tells the two apart
fail→pass·tests/test_timeutils.py::test_daterange_infinite
Check file tests/test_timeutils.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 itd931428f0ad6b316e4e1978f18b080f0a0c340c0
Broken version dated2018-10-11
Moduleboltons.timeutils
Units changeddaterange
Fingerprintf6a035c2a6d8ab8d
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in mahmoud/boltons
- 2026-08-06Bits
- 2026-08-06JSONLIterator
- 2026-08-06tableutils: fix Table.to_text crashes on degenerate tables and headers
- 2026-07-18backoff_iter
- 2026-07-17singularize
- 2026-07-17fix(fileutils): accept os.PathLike in AtomicSaver