Message253735
> 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. |
|
Date |
User |
Action |
Args |
2015-10-30 14:48:00 | whit537 | set | recipients:
+ whit537, orsenthil, eric.araujo, BreamoreBoy, Alexander.Tsepkov |
2015-10-30 14:48:00 | whit537 | set | messageid: <1446216480.13.0.934473529026.issue11315@psf.upfronthosting.co.za> |
2015-10-30 14:48:00 | whit537 | link | issue11315 messages |
2015-10-30 14:47:59 | whit537 | create | |
|