Issue 26650: calendar: OverflowErrors for year == 1 and firstweekday > 0 (original) (raw)
For anything other than calendar.Calendar(0), many methods lead to OverflowError exceptions:
import calendar c = calendar.Calendar(0) list(c.itermonthdays(1, 1)) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, 0] c = calendar.Calendar(1) list(c.itermonthdays(1, 1)) Traceback (most recent call last): File "", line 1, in File "/Users/mjpieters/Development/Library/buildout.python/parts/opt/lib/python2.7/calendar.py", line 188, in itermonthdays for date in self.itermonthdates(year, month): File "/Users/mjpieters/Development/Library/buildout.python/parts/opt/lib/python2.7/calendar.py", line 160, in itermonthdates date -= datetime.timedelta(days=days) OverflowError: date value out of range
This echoes a similar problem with year = 9999, see issue #15421