classification
Title: SimpleCookie not unpicklable with protocol 2+
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Arfrever, Tim.Graham, berker.peksag, georg.brandl, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2014-10-31 16:58 by Tim.Graham, last changed 2014-11-04 07:47 by georg.brandl. This issue is now closed.

Files
File name Uploaded Description Edit
cookie-pickle-highest.diff Tim.Graham, 2014-10-31 16:58 review
cookie-pickling-all-protocols.diff Tim.Graham, 2014-11-01 16:50 review
cookie-pickling-all-protocols-2.diff Tim.Graham, 2014-11-02 18:46 review
Messages (11)
msg230354 - (view) Author: Tim Graham (Tim.Graham) * Date: 2014-10-31 16:58
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 #22758 (I added the "else" as the fix did not work without it).
msg230355 - (view) Author: Tim Graham (Tim.Graham) * Date: 2014-10-31 17:01
By the way, this is my first patch for Python and I submitted a CLA 2 days ago.
msg230436 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-01 08:39
Test pickling with all protocols (see issue22777), not only with HIGHEST_PROTOCOL.
msg230452 - (view) Author: Tim Graham (Tim.Graham) * Date: 2014-11-01 16:50
Updated patch to test pickling of all protocols.
msg230516 - (view) Author: Tim Graham (Tim.Graham) * Date: 2014-11-02 18:46
Updated patch per comments.
msg230520 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-02 20:02
LGTM.
msg230521 - (view) Author: Roundup Robot (python-dev) Date: 2014-11-02 20:22
New changeset 7be6ef737aaf by Serhiy Storchaka in branch '3.4':
Issue #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 #22775: Fixed unpickling of http.cookies.SimpleCookie with protocol 2
https://hg.python.org/cpython/rev/caa8f9248ab8
msg230522 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-02 20:24
Thank you for your contribution Tim.
msg230523 - (view) Author: Roundup Robot (python-dev) Date: 2014-11-02 20:37
New changeset 515331e0ca0c by Serhiy Storchaka in branch '2.7':
Issue #22775: Fixed unpickling of Cookie.SimpleCookie with protocol 2.
https://hg.python.org/cpython/rev/515331e0ca0c
msg230524 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-11-02 20:39
This affects 2.7 too.
msg230587 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-11-04 07:47
Thanks!
History
Date User Action Args
2014-11-04 07:47:25georg.brandlsetmessages: + msg230587
2014-11-02 20:39:34serhiy.storchakasettitle: SimpleCookie not picklable with HIGHEST_PROTOCOL -> SimpleCookie not unpicklable with protocol 2+
messages: + msg230524
versions: + Python 2.7
2014-11-02 20:37:50python-devsetmessages: + msg230523
2014-11-02 20:24:49serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg230522

stage: commit review -> resolved
2014-11-02 20:22:49python-devsetnosy: + python-dev
messages: + msg230521
2014-11-02 20:02:01serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg230520
stage: patch review -> commit review
2014-11-02 18:46:08Tim.Grahamsetfiles: + cookie-pickling-all-protocols-2.diff

messages: + msg230516
2014-11-01 16:50:32Tim.Grahamsetfiles: + cookie-pickling-all-protocols.diff

messages: + msg230452
2014-11-01 08:39:28serhiy.storchakasetmessages: + msg230436
2014-10-31 22:45:42pitrousetnosy: + serhiy.storchaka
2014-10-31 20:08:45berker.peksagsetstage: patch review
versions: + Python 3.4
2014-10-31 18:22:11Arfreversetnosy: + Arfrever
2014-10-31 17:01:15Tim.Grahamsetmessages: + msg230355
2014-10-31 16:58:03Tim.Grahamcreate