From 59f7cb2a10c78b78be64d220a34a53ac794c6fcd Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 31 Dec 2013 09:14:04 +1100 Subject: [PATCH] ical.py: clear up confusion with 'last' and 'next'. The value stored in 'last' was being over-written. This could lead to the end condition failing sometimes. 'last' is the last value added. we stop when that exceeds the end point. 'next' is the next value to add. --- lib/ical.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ical.py b/lib/ical.py index 5081d1b..1f5204b 100644 --- a/lib/ical.py +++ b/lib/ical.py @@ -613,9 +613,10 @@ byaction = { def make_dates(start, rr): ret = [] last = start + next = last s = date_seq(start, rr.interval, rr.step) while (rr.count != None and len(ret) < rr.count) or (rr.end != None and last.before(rr.end)): - n1 = [ copy.copy(last) ] + n1 = [ copy.copy(next) ] for bn in byorder: if bn not in rr.bylist: continue @@ -652,9 +653,9 @@ def make_dates(start, rr): if n1: last = n1[-1] ret.extend(n1) - last, valid = s.next() + next, valid = s.next() while not valid and 'BYDAY' not in rr.bylist and 'BYMONTHDAY' not in rr.bylist: - last, valid = s.next() + next, valid = s.next() if rr.count: ret = ret[:rr.count] if rr.end: -- 2.39.5