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.

Author whit537
Recipients Alexander.Tsepkov, BreamoreBoy, eric.araujo, orsenthil, whit537
Date 2015-10-30.14:47:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446216480.13.0.934473529026.issue11315@psf.upfronthosting.co.za>
In-reply-to
Content
> in the 3.x version, only character strings (unicode) are accepted
> The code was changed to do this in r83361 #3788.

That seems like a bug to me. It looks like the intention was to avoid the `type("")` check for stylistic reasons, so `isinstance(rawdata, str)` is an understandable translation under 3.1 (which #3788 targets), but I suspect that `type("")` should never have survived the transition to Python 3 in the first place. The 2.7 branch still has `type("")` (not `str("")` as originally reported):

https://hg.python.org/cpython/file/2.7/Lib/Cookie.py#l639


> “raw” would suggest to me than only bytes make sense.

Agreed. Cookie names and values are constrained to a subset of ASCII:

https://tools.ietf.org/html/rfc6265#section-4.1.1

I suggest cookies be thought of as a binary data store, with programmers responsible to encode/decode their data at the boundary with the cookies library.


> I would tend to edit the documentation but no[t] the behavior, given that 2.7 is stable and this behavior has been present and documented for a long time.

Leaving 2.7 as-is makes sense, but now I think it looks like we have a regression in 3, which should be fixed.

----

P.S. I arrived here from https://github.com/gratipay/aspen.py/pull/524.
History
Date User Action Args
2015-10-30 14:48:00whit537setrecipients: + whit537, orsenthil, eric.araujo, BreamoreBoy, Alexander.Tsepkov
2015-10-30 14:48:00whit537setmessageid: <1446216480.13.0.934473529026.issue11315@psf.upfronthosting.co.za>
2015-10-30 14:48:00whit537linkissue11315 messages
2015-10-30 14:47:59whit537create