mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
#15421: fix an OverflowError in Calendar.itermonthdates() after datetime.MAXYEAR. Patch by Cédric Krier.
This commit is contained in:
parent
003014bf1e
commit
cadff70ba5
3 changed files with 14 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue