[issue26650] calendar: OverflowErrors for year == 1 and firstweekday > 0

Martijn Pieters report at bugs.python.org
Sun Mar 27 05:38:56 EDT 2016


New submission from Martijn Pieters:

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 "<stdin>", line 1, in <module>
  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

----------
components: Library (Lib)
messages: 262514
nosy: mjpieters
priority: normal
severity: normal
status: open
title: calendar: OverflowErrors for year == 1 and firstweekday > 0
type: crash
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26650>
_______________________________________


More information about the Python-bugs-list mailing list