[Python-checkins] python/dist/src/Lib calendar.py,1.31,1.32
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Thu, 13 Feb 2003 14:58:05 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv17485
Modified Files:
calendar.py
Log Message:
SF 685011: calendar module overflow handling
Restored a Py2.2 behavior to not range check the day of the month.
A user application was this exploiting undocumented, accidental "feature".
Index: calendar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** calendar.py 25 Dec 2002 16:37:19 -0000 1.31
--- calendar.py 13 Feb 2003 22:58:02 -0000 1.32
***************
*** 214,218 ****
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
year, month, day, hour, minute, second = tuple[:6]
! days = datetime.date(year, month, day).toordinal() - _EPOCH_ORD
hours = days*24 + hour
minutes = hours*60 + minute
--- 214,218 ----
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
year, month, day, hour, minute, second = tuple[:6]
! days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
hours = days*24 + hour
minutes = hours*60 + minute