Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookielib.http2time raises ValueError for invalid date. #60385

Closed
CharlesJones mannequin opened this issue Oct 9, 2012 · 4 comments
Closed

cookielib.http2time raises ValueError for invalid date. #60385

CharlesJones mannequin opened this issue Oct 9, 2012 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@CharlesJones
Copy link
Mannequin

CharlesJones mannequin commented Oct 9, 2012

BPO 16181
Nosy @berkerpeksag
Files
  • issue16181_v1.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-03-14.03:49:11.347>
    created_at = <Date 2012-10-09.20:06:52.264>
    labels = ['type-bug', 'library']
    title = 'cookielib.http2time raises ValueError for invalid date.'
    updated_at = <Date 2016-03-14.03:49:11.278>
    user = 'https://bugs.python.org/CharlesJones'

    bugs.python.org fields:

    activity = <Date 2016-03-14.03:49:11.278>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-03-14.03:49:11.347>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2012-10-09.20:06:52.264>
    creator = 'Charles.Jones'
    dependencies = []
    files = ['29140']
    hgrepos = []
    issue_num = 16181
    keywords = ['patch']
    message_count = 4.0
    messages = ['172515', '182582', '220640', '261721']
    nosy_count = 4.0
    nosy_names = ['BreamoreBoy', 'python-dev', 'berker.peksag', 'Charles.Jones']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue16181'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6']

    @CharlesJones
    Copy link
    Mannequin Author

    CharlesJones mannequin commented Oct 9, 2012

    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 calendar.date()).

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

    Expected Result:
    Should return None

    Actual Result:
    Raises ValueError: year is out of range

    @CharlesJones CharlesJones mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 9, 2012
    @berkerpeksag
    Copy link
    Member

    Patch attached with a test.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 15, 2014

    A simple patch is attached so could someone take a look please, thanks.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 14, 2016

    New changeset 838f68a76ea1 by Berker Peksag in branch '3.5':
    Issue bpo-16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR
    https://hg.python.org/cpython/rev/838f68a76ea1

    New changeset 8b7de03261f5 by Berker Peksag in branch 'default':
    Issue bpo-16181: cookiejar.http2time() now returns None if year is higher than datetime.MAXYEAR
    https://hg.python.org/cpython/rev/8b7de03261f5

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant