summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-03-14 03:48:02 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-03-14 03:48:02 (GMT)
commit20be53e5b51a3388454cb7d0604a03a20d884510 (patch)
treeca6e0e04ab14a0bd57ab3577e2d15e82ee7771f8 /Lib/http
parentf2b9a398133a291a6f0fd42d8a9e42b8ded605fb (diff)
downloadcpython-20be53e5b51a3388454cb7d0604a03a20d884510.zip
cpython-20be53e5b51a3388454cb7d0604a03a20d884510.tar.gz
cpython-20be53e5b51a3388454cb7d0604a03a20d884510.tar.bz2
Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR
Diffstat (limited to 'Lib/http')
-rw-r--r--Lib/http/cookiejar.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/http/cookiejar.py b/Lib/http/cookiejar.py
index ac5e667..bd367f9 100644
--- a/Lib/http/cookiejar.py
+++ b/Lib/http/cookiejar.py
@@ -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)