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".
This commit is contained in:
parent
1442dc1194
commit
61436489f9
@ -213,7 +213,7 @@ _EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal()
|
|||||||
def timegm(tuple):
|
def timegm(tuple):
|
||||||
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
|
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
|
||||||
year, month, day, hour, minute, second = tuple[:6]
|
year, month, day, hour, minute, second = tuple[:6]
|
||||||
days = datetime.date(year, month, day).toordinal() - _EPOCH_ORD
|
days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
|
||||||
hours = days*24 + hour
|
hours = days*24 + hour
|
||||||
minutes = hours*60 + minute
|
minutes = hours*60 + minute
|
||||||
seconds = minutes*60 + second
|
seconds = minutes*60 + second
|
||||||
|
Loading…
x
Reference in New Issue
Block a user