[Python-bugs-list] [ python-Bugs-434143 ] calendar module broken for 1900

noreply@sourceforge.net noreply@sourceforge.net
Mon, 18 Jun 2001 04:56:53 -0700


Bugs item #434143, was updated on 2001-06-18 04:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=434143&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexandre Fayolle (afayolle)
Assigned to: Nobody/Anonymous (nobody)
Summary: calendar module broken for 1900

Initial Comment:
Hi there, this is a 'feature' I met on both 1.5.2 and
2.1.

>>> import calendar
>>> calendar.prcal(1865)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.1/calendar.py", line 160, in
prcal
    print calendar(year, w, l, c),
  File "/usr/lib/python2.1/calendar.py", line 179, in
calendar
    cal = monthcalendar(year, amonth)
  File "/usr/lib/python2.1/calendar.py", line 85, in
monthcalendar
    day1, ndays = monthrange(year, month)
  File "/usr/lib/python2.1/calendar.py", line 78, in
monthrange
    day1 = weekday(year, month, 1)
  File "/usr/lib/python2.1/calendar.py", line 69, in
weekday
    secs = mktime((year, month, day, 0, 0, 0, 0, 0, 0))
ValueError: year out of range (00-99, 1900-*)

(note that the documentation only refers to 1970 as a
possible limit, and does not mention how dates in 00-99
range are processed)

Now if I try to get the calendar for year 1900 (which
is supposed to work according to the message
hereabove), I get

>>> calendar.prcal(1900)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.1/calendar.py", line 160, in
prcal
    print calendar(year, w, l, c),
  File "/usr/lib/python2.1/calendar.py", line 179, in
calendar
    cal = monthcalendar(year, amonth)
  File "/usr/lib/python2.1/calendar.py", line 85, in
monthcalendar
    day1, ndays = monthrange(year, month)
  File "/usr/lib/python2.1/calendar.py", line 78, in
monthrange
    day1 = weekday(year, month, 1)
  File "/usr/lib/python2.1/calendar.py", line 69, in
weekday
    secs = mktime((year, month, day, 0, 0, 0, 0, 0, 0))
OverflowError: mktime argument out of range

I guess this is low priority. 

Cheers 

Alexandre Fayolle


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=434143&group_id=5470