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

SimpleCookie not unpicklable with protocol 2+ #66964

Closed
timgraham mannequin opened this issue Oct 31, 2014 · 11 comments
Closed

SimpleCookie not unpicklable with protocol 2+ #66964

timgraham mannequin opened this issue Oct 31, 2014 · 11 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@timgraham
Copy link
Mannequin

timgraham mannequin commented Oct 31, 2014

BPO 22775
Nosy @birkenfeld, @berkerpeksag, @serhiy-storchaka, @timgraham
Files
  • cookie-pickle-highest.diff
  • cookie-pickling-all-protocols.diff
  • cookie-pickling-all-protocols-2.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 = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2014-11-02.20:24:49.309>
    created_at = <Date 2014-10-31.16:58:03.444>
    labels = ['type-bug', 'library']
    title = 'SimpleCookie not unpicklable with protocol 2+'
    updated_at = <Date 2014-11-04.07:47:25.522>
    user = 'https://github.com/timgraham'

    bugs.python.org fields:

    activity = <Date 2014-11-04.07:47:25.522>
    actor = 'georg.brandl'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-11-02.20:24:49.309>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2014-10-31.16:58:03.444>
    creator = 'Tim.Graham'
    dependencies = []
    files = ['37088', '37100', '37114']
    hgrepos = []
    issue_num = 22775
    keywords = ['patch']
    message_count = 11.0
    messages = ['230354', '230355', '230436', '230452', '230516', '230520', '230521', '230522', '230523', '230524', '230587']
    nosy_count = 6.0
    nosy_names = ['georg.brandl', 'Arfrever', 'python-dev', 'berker.peksag', 'serhiy.storchaka', 'Tim.Graham']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue22775'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5']

    @timgraham
    Copy link
    Mannequin Author

    timgraham mannequin commented Oct 31, 2014

    Expected:

    >>> import pickle
    >>> from http.cookies import SimpleCookie
    >>> pickle.loads(pickle.dumps(SimpleCookie('hi=there'),2))
    <SimpleCookie: hi='there'>
    # Actual
    <SimpleCookie: hi='Set-Cookie: hi=there'>

    Patch is based on the suggestion from Georg Brandl in bpo-22758 (I added the "else" as the fix did not work without it).

    @timgraham timgraham mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Oct 31, 2014
    @timgraham
    Copy link
    Mannequin Author

    timgraham mannequin commented Oct 31, 2014

    By the way, this is my first patch for Python and I submitted a CLA 2 days ago.

    @serhiy-storchaka
    Copy link
    Member

    Test pickling with all protocols (see bpo-22777), not only with HIGHEST_PROTOCOL.

    @timgraham
    Copy link
    Mannequin Author

    timgraham mannequin commented Nov 1, 2014

    Updated patch to test pickling of all protocols.

    @timgraham
    Copy link
    Mannequin Author

    timgraham mannequin commented Nov 2, 2014

    Updated patch per comments.

    @serhiy-storchaka
    Copy link
    Member

    LGTM.

    @serhiy-storchaka serhiy-storchaka self-assigned this Nov 2, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2014

    New changeset 7be6ef737aaf by Serhiy Storchaka in branch '3.4':
    Issue bpo-22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2
    https://hg.python.org/cpython/rev/7be6ef737aaf

    New changeset caa8f9248ab8 by Serhiy Storchaka in branch 'default':
    Issue bpo-22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2
    https://hg.python.org/cpython/rev/caa8f9248ab8

    @serhiy-storchaka
    Copy link
    Member

    Thank you for your contribution Tim.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2014

    New changeset 515331e0ca0c by Serhiy Storchaka in branch '2.7':
    Issue bpo-22775: Fixed unpickling of Cookie.SimpleCookie with protocol 2.
    https://hg.python.org/cpython/rev/515331e0ca0c

    @serhiy-storchaka
    Copy link
    Member

    This affects 2.7 too.

    @serhiy-storchaka serhiy-storchaka changed the title SimpleCookie not picklable with HIGHEST_PROTOCOL SimpleCookie not unpicklable with protocol 2+ Nov 2, 2014
    @birkenfeld
    Copy link
    Member

    Thanks!

    @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

    2 participants