Author Tim.Graham
Recipients Tim.Graham, berker.peksag, georg.brandl, pitrou, r.david.murray
Date 2014-10-29.10:14:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414577677.93.0.364604019199.issue22758@psf.upfronthosting.co.za>
In-reply-to
Content
I noticed some failing Django tests on Python 3.2.6 the other day. The regression is caused by this change: https://github.com/python/cpython/commit/572d9c59a1441c6f8ffb9308824c804856020e31

Behavior before that commit (and on other version of Python even after that commit):

>>> from http.cookies import SimpleCookie
>>> SimpleCookie("Set-Cookie: foo=bar; Path=/")
<SimpleCookie: foo='bar'>

New broken behavior on Python 3.2.6:

>>> from http.cookies import SimpleCookie
>>> SimpleCookie("Set-Cookie: foo=bar; Path=/")
<SimpleCookie: >

Python 3.2.6 no longer accepts the "Set-Cookie: " prefix to BaseCookie.load:

>>> SimpleCookie("Set-Cookie: foo=bar; Path=/")
<SimpleCookie: >
>>> SimpleCookie("foo=bar; Path=/")
<SimpleCookie: foo='bar'>

This issue doesn't affect 2.7, 3.3, or 3.4 because of https://github.com/python/cpython/commit/b92e104dc57c37ddf22ada1c6e5380e09268ee93 (this commit wasn't backported to 3.2 because that branch is in security-fix-only mode).

I asked Berker about this and he suggested to create this issue and said, "If Georg is OK to backout the commit I can write a patch with additional test cases and commit it."

He also confirmed the regression as follows:

I've tested your example on Python 2.7.8, 3.2.6, 3.3.6, 3.4.2, 3.5.0 (all unreleased development versions - they will be X.Y.Z+1) and looks like it's a regression.

My test script is:

    try:
        from http.cookies import SimpleCookie
    except ImportError:
        from Cookie import SimpleCookie

    c = SimpleCookie("Set-Cookie: foo=bar; Path=/")
    print(c)

Here are the results:

Python 2.7.8:
Set-Cookie: foo=bar; Path=/

Python 3.5.0:
Set-Cookie: foo=bar; Path=/

Python 3.4.2:
Set-Cookie: foo=bar; Path=/

Python 3.3.6:
Set-Cookie: foo=bar; Path=/
[45602 refs]

Python 3.2.6:

[38937 refs]
History
Date User Action Args
2014-10-29 10:14:38Tim.Grahamsetrecipients: + Tim.Graham, georg.brandl, pitrou, r.david.murray, berker.peksag
2014-10-29 10:14:37Tim.Grahamsetmessageid: <1414577677.93.0.364604019199.issue22758@psf.upfronthosting.co.za>
2014-10-29 10:14:37Tim.Grahamlinkissue22758 messages
2014-10-29 10:14:37Tim.Grahamcreate