changeset: 100518:838f68a76ea1 branch: 3.5 parent: 100515:78e9c18d3e5b user: Berker Peksag date: Mon Mar 14 05:48:02 2016 +0200 files: Lib/http/cookiejar.py Lib/test/test_http_cookiejar.py Misc/NEWS description: Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR diff -r 78e9c18d3e5b -r 838f68a76ea1 Lib/http/cookiejar.py --- a/Lib/http/cookiejar.py Sun Mar 13 11:41:05 2016 +0200 +++ b/Lib/http/cookiejar.py Mon Mar 14 05:48:02 2016 +0200 @@ -143,6 +143,10 @@ 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 @@ if min is None: min = 0 if sec is None: sec = 0 - yr = int(yr) day = int(day) hr = int(hr) min = int(min) diff -r 78e9c18d3e5b -r 838f68a76ea1 Lib/test/test_http_cookiejar.py --- a/Lib/test/test_http_cookiejar.py Sun Mar 13 11:41:05 2016 +0200 +++ b/Lib/test/test_http_cookiejar.py Mon Mar 14 05:48:02 2016 +0200 @@ -91,6 +91,10 @@ '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" diff -r 78e9c18d3e5b -r 838f68a76ea1 Misc/NEWS --- a/Misc/NEWS Sun Mar 13 11:41:05 2016 +0200 +++ b/Misc/NEWS Mon Mar 14 05:48:02 2016 +0200 @@ -91,6 +91,9 @@ 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