Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR
This commit is contained in:
parent
f2b9a39813
commit
20be53e5b5
|
@ -143,6 +143,10 @@ def offset_from_tz_string(tz):
|
|||
return offset
|
||||
|
||||
def _str2time(day, mon, yr, hr, min, sec, tz):
|
||||
yr = int(yr)
|
||||
if yr > datetime.MAXYEAR:
|
||||
return None
|
||||
|
||||
# translate month name to number
|
||||
# month numbers start with 1 (January)
|
||||
try:
|
||||
|
@ -163,7 +167,6 @@ def _str2time(day, mon, yr, hr, min, sec, tz):
|
|||
if min is None: min = 0
|
||||
if sec is None: sec = 0
|
||||
|
||||
yr = int(yr)
|
||||
day = int(day)
|
||||
hr = int(hr)
|
||||
min = int(min)
|
||||
|
|
|
@ -91,6 +91,10 @@ class DateTimeTests(unittest.TestCase):
|
|||
'01-01-1980 25:00:00',
|
||||
'01-01-1980 00:61:00',
|
||||
'01-01-1980 00:00:62',
|
||||
'08-Oct-3697739',
|
||||
'08-01-3697739',
|
||||
'09 Feb 19942632 22:23:32 GMT',
|
||||
'Wed, 09 Feb 1994834 22:23:32 GMT',
|
||||
]:
|
||||
self.assertIsNone(http2time(test),
|
||||
"http2time(%s) is not None\n"
|
||||
|
|
|
@ -91,6 +91,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #16181: cookiejar.http2time() now returns None if year is higher than
|
||||
datetime.MAXYEAR.
|
||||
|
||||
- Issue #26513: Fixes platform module detection of Windows Server
|
||||
|
||||
- Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by
|
||||
|
|
Loading…
Reference in New Issue