-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-12910: update and correct quote docstring #2568
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Fixes some mistakes and misleadings in the quote function docstring: - reserved chars are never actually used by quote code, unreserved chars are - reserved chars were wrong and incomplete - mentioned that use-case is not minimal quoting wrt. RFC, but cautious quoting
@the-knights-who-say-ni re-check? |
This PR is being in 'awaiting review' state for a while. Meanwhile the doc has been simply wrong about tilde and reserved characters. The problem seems old, |
@joernhees @brettcannon |
the "quotational" parts the comments in the code referring to the RFCs? From my point of view it would make sense to update them, but not without clearly pointing out that the code does not strictly follow them for backwards compatibility reasons |
I think I understand your point. One problem is that to 'strictly follow', |
Not sure if i fully understand your statement / question: the list of chars
Still i'm quite sure that discussing those and what should've been stated in the RFC in the end doesn't lead us anywhere ;) This PR is about fixing the mistakes in the docs that might mislead people (e.g., myself). The quote function %-escapes all characters that are neither in the unreserved chars from RFC 3986 ( |
Sorry for the confusion, I shouldn't have included '/' and '%'. I still feel strange about the passing mention in RFC 3987, I brought up the two commits above, since they are so simple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @joernhees and @csabella
Give me a moment - I skipped the reference to the change in characters in the comment, and I only assumed it was grammar correction. I am looking at this again. |
"$" | "," | "~" | ||
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" | ||
reserved = gen-delims / sub-delims | ||
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the "/"
character to "|" first. Even in the comments, if we preserved the previous doc, it won't intuitively break our reading. At other places, "|" is used for or condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was used as per the RFC example:
https://tools.ietf.org/html/rfc3986#appendix-A
This is okay!
Thanks for this discussion. The documentation change makes sense.
So, this should cover for the usage scenarios, and I am going to ahead with +1 with this change. Thank you! |
Thanks @joernhees for the PR, and @orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
@orsenthil: Please replace |
Fixes some mistakes and misleadings in the quote function docstring: - reserved chars are never actually used by quote code, unreserved chars are - reserved chars were wrong and incomplete - mentioned that use-case is not minimal quoting wrt. RFC, but cautious quoting (cherry picked from commit 750d74f) Co-authored-by: Jörn Hees <[email protected]>
GH-12754 is a backport of this pull request to the 3.7 branch. |
Fixes some mistakes and misleadings in the quote function docstring: - reserved chars are never actually used by quote code, unreserved chars are - reserved chars were wrong and incomplete - mentioned that use-case is not minimal quoting wrt. RFC, but cautious quoting (cherry picked from commit 750d74f) Co-authored-by: Jörn Hees <[email protected]>
Thank @joernhees for the PR and thank you @orsenthil for the review and merge! |
@orsenthil change also parse.rst. https://github.com/python/cpython/blob/master/Doc/library/urllib.parse.rst ... versionchanged:: 3.7 |
@openandclose - Sure. Thanks for this note. |
Fixes some mistakes and misleadings in the quote function docstring:
see discussion in https://bugs.python.org/issue12910