taichino / croniter

croniter is a python module to provide iteration for datetime object.
http://github.com/taichino/croniter
387 stars 105 forks source link

get_next("* * 31 2 *") will raise ValueError after a long time. #34

Closed binzeehale closed 7 years ago

binzeehale commented 10 years ago

croniter will not raise erorr , but it will be error when i call get_next. The most important: this crontab string will cause a long loop before the error happened.

josegonzalez commented 8 years ago

Interestingly, on the latest master, this returns an exception about failing to find the previous date...

$ python src/croniter/tests/test_croniter.py
............................E.
======================================================================
ERROR: test_bug34 (__main__.CroniterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "src/croniter/tests/test_croniter.py", line 394, in test_bug34
    n1 = itr.get_next(datetime)
  File "/Users/jose/Apps/seatgeek/oss/croniter/src/croniter/croniter.py", line 142, in get_next
    return self._get_next(ret_type or self._ret_type, is_prev=False)
  File "/Users/jose/Apps/seatgeek/oss/croniter/src/croniter/croniter.py", line 228, in _get_next
    result = self._calc(self.cur, expanded, is_prev)
  File "/Users/jose/Apps/seatgeek/oss/croniter/src/croniter/croniter.py", line 366, in _calc
    raise Exception("failed to find prev date")
Exception: failed to find prev date

----------------------------------------------------------------------
Ran 30 tests in 0.037s

FAILED (errors=1)