diff options
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r-- | Lib/calendar.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py index 0301d6b..3bbf399 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -161,7 +161,11 @@ class Calendar(object): oneday = datetime.timedelta(days=1) while True: yield date - date += oneday + try: + date += oneday + except OverflowError: + # Adding one day could fail after datetime.MAXYEAR + break if date.month != month and date.weekday() == self.firstweekday: break |