summaryrefslogtreecommitdiffstats
path: root/Lib/http
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-03-14 03:48:28 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-03-14 03:48:28 (GMT)
commit0647ef05ebe3802617978b9f92922e6e9d33eaac (patch)
treee6990fd530d149e68294ce0b6893e0a7db5bf047 /Lib/http
parent4c9375b65f4788b73cfa46f3daa94143b49273fa (diff)
parent20be53e5b51a3388454cb7d0604a03a20d884510 (diff)
downloadcpython-0647ef05ebe3802617978b9f92922e6e9d33eaac.zip
cpython-0647ef05ebe3802617978b9f92922e6e9d33eaac.tar.gz
cpython-0647ef05ebe3802617978b9f92922e6e9d33eaac.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)