summaryrefslogtreecommitdiff
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-09-29 14:14:19 -0400
committerBenjamin Peterson <benjamin@python.org>2012-09-29 14:14:19 -0400
commit14fb44e1bab9db128770f1d91d244916a669e7c3 (patch)
tree278d9ccc8f819b05f8114c3154087c70b88ed69c /Lib/calendar.py
parent1764c80925795b6f059e961c5a352c5ece5a7fff (diff)
parent99a247fd01c1cd780c0c3ee1116657627f1ee744 (diff)
downloadcpython-git-14fb44e1bab9db128770f1d91d244916a669e7c3.tar.gz
merge mostly from default
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 0301d6b5d6..3bbf399649 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