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 joern
Recipients cheryl.sabella, eric.araujo, ezio.melotti, joern, orsenthil
Date 2017-07-04.15:16:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499181411.14.0.907765915914.issue12910@psf.upfronthosting.co.za>
In-reply-to
Content
It's been a while... nowadays I would mostly change the documentation of the quote function to point out that it is likely to quote more characters than absolutely necessary by SPEC. The function is in place for so long, (even in py3) that people will rely on the behavior.

I made an attempt to update the docstring accordingly in https://github.com/python/cpython/pull/2568


What i think is most confusing is the current docs mentioning the reserved chars (which are btw. definitely wrong wrt. RFC3986). Actually as one can see in the code the reserved chars don't play any role for quote, but much more the unreserved chars (called _ALWAYS_SAFE https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L716 ).

   unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"

The current quote function's approach is to simply quote everything that is not in unreserved + safe (per arg).

In that aspect it is quite close to the old javascript.escape function: https://www.w3schools.com/jsref/jsref_escape.asp


quick links
py2.7: https://github.com/python/cpython/blob/2.7/Lib/urllib.py#L1261
py3: https://github.com/python/cpython/blob/master/Lib/urllib/parse.py#L745
RFC3986: https://tools.ietf.org/html/rfc3986#appendix-A
History
Date User Action Args
2017-07-04 15:16:51joernsetrecipients: + joern, orsenthil, ezio.melotti, eric.araujo, cheryl.sabella
2017-07-04 15:16:51joernsetmessageid: <1499181411.14.0.907765915914.issue12910@psf.upfronthosting.co.za>
2017-07-04 15:16:51joernlinkissue12910 messages
2017-07-04 15:16:51joerncreate