don't overflow time value (would happen with excessive years)
>>> t [20004, 6, 2, 0, 17, 3, 2, 154, 1] >>> time.mktime(t) Traceback (most recent call last): File "<stdin>", line 1, in ? OverflowError: mktime argument out of range
This commit is contained in:
parent
d24e99166c
commit
9415993849
|
@ -1298,7 +1298,10 @@ class Time(BaseKind):
|
|||
# Set Daylight Saving Time to -1, so that it is handled
|
||||
# correctly by mktime.
|
||||
t = tuple(list(t[0:-1]) + [-1])
|
||||
value = time.mktime(t)
|
||||
try:
|
||||
value = time.mktime(t)
|
||||
except OverflowError:
|
||||
raise faults.BadValue()
|
||||
return value
|
||||
return BaseKind.convertValueFromOtherType(self, value)
|
||||
|
||||
|
|
Reference in New Issue