This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: cookielib.http2time raises ValueError for invalid date.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Charles.Jones, berker.peksag, python-dev
Priority: normal Keywords: patch

Created on 2012-10-09 20:06 by Charles.Jones, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue16181_v1.diff berker.peksag, 2013-02-21 09:04 review
Messages (4)
msg172515 - (view) Author: Charles Jones (Charles.Jones) Date: 2012-10-09 20:06
The docs for http2time state that "None is returned if [...] the time is outside the representable range". However, it is raising a ValueError when a year larger than datetime.MAXYEAR is provided (actually raised downstream by

To reproduce:
import cookielib
print cookielib.http2time("08-Oct-3697739")

Expected Result:
Should return None

Actual Result:
Raises ValueError: year is out of range
msg182582 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2013-02-21 09:04
Patch attached with a test.
msg220640 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-15 14:26
A simple patch is attached so could someone take a look please, thanks.
msg261721 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-03-14 03:47
New changeset 838f68a76ea1 by Berker Peksag in branch '3.5':
Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR

New changeset 8b7de03261f5 by Berker Peksag in branch 'default':
Issue #16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR
Date User Action Args
2022-04-11 14:57:37adminsetgithub: 60385
2016-03-14 03:49:11berker.peksagsetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.6, - Python 3.4
2016-03-14 03:47:46python-devsetnosy: + python-dev
messages: + msg261721
2014-06-15 14:36:30berker.peksagsetstage: patch review
versions: + Python 3.5, - Python 3.3
2014-06-15 14:26:53BreamoreBoysetnosy: + BreamoreBoy
messages: + msg220640
2013-02-21 09:04:48berker.peksagsetfiles: + issue16181_v1.diff
versions: + Python 3.3, Python 3.4
nosy: + berker.peksag

messages: + msg182582

keywords: + patch
2012-10-09 20:06:52Charles.Jonescreate