homepage

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.

classification
Title: urlparse() documentation does not account for default scheme
Type: behavior Stage: resolved
Components: Documentation, Tests Versions: Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: berker.peksag Nosy List: berker.peksag, demian.brecht, docs@python, martin.panter, python-dev
Priority: normal Keywords: patch

Created on 2015年03月17日 01:39 by martin.panter, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
urlparse-scheme.patch martin.panter, 2015年05月31日 10:45 review
Messages (7)
msg238253 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015年03月17日 01:39
The documentation for urlsplit() says:
'''
urlparse(urlstring, scheme='', allow_fragments=True)
. . .
If the scheme argument is specified, it gives the default addressing scheme, to be used only if the URL does not specify one. The default value for this argument is the empty string.
'''
However this contradicts the table of attributes, which gives:
Attribute: scheme, . . . Value if not present: empty string
Similarly for urlsplit(). Of course, the description of the "scheme" parameter is correct, and the table is only correct when no "scheme" parameter is given:
>>> urlparse("//example.net").scheme
''
>>> urlparse(b"//example.net").scheme
b''
>>> urlparse("//example.net", "http").scheme
'http'
This issue is split off another where I tried to sneak in a quick fix, but the wording probably needs more thought. Original change: <https://bugs.python.org/review/22852/patch/14176/52720#old-line-92>.
Maybe change it to this?
Value if not present: empty string or default scheme
msg238293 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015年03月17日 14:24
+1 to the change, but I'd propose maybe "value of *scheme*" given the tables are inline with both urlsplit and urlparse docs?
msg244531 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015年05月31日 10:45
Here is a patch changing the table entries to "*scheme* argument". Hopefully this is fairly obvious and doesn’t sound like it defaults to itself.
I also made the descriptions of "scheme" and "allow_fragments" more specific, and added some unit tests, because there didn’t seem to be any exercising them.
msg245611 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015年06月21日 22:02
LGTM. Added a minor question on Rietveld.
msg245828 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015年06月25日 20:39
New changeset 368db4b1ced9 by Berker Peksag in branch '3.4':
Issue #23684: Clarify the return value of the scheme attribute of ParseResult and SplitResult objects.
https://hg.python.org/cpython/rev/368db4b1ced9
New changeset 68629ebe0fee by Berker Peksag in branch '3.5':
Issue #23684: Clarify the return value of the scheme attribute of ParseResult and SplitResult objects.
https://hg.python.org/cpython/rev/68629ebe0fee
New changeset 7846aadbd4f5 by Berker Peksag in branch 'default':
Issue #23684: Clarify the return value of the scheme attribute of ParseResult and SplitResult objects.
https://hg.python.org/cpython/rev/7846aadbd4f5 
msg245829 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015年06月25日 20:46
New changeset 7bf9e10fc32f by Berker Peksag in branch '2.7':
Issue #23684: Clarify the return value of the scheme attribute of ParseResult and SplitResult objects.
https://hg.python.org/cpython/rev/7bf9e10fc32f 
msg245830 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2015年06月25日 20:48
Thanks Martin.
History
Date User Action Args
2022年04月11日 14:58:13adminsetgithub: 67872
2015年06月25日 20:48:04berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg245830

stage: commit review -> resolved
2015年06月25日 20:46:51python-devsetmessages: + msg245829
2015年06月25日 20:39:03python-devsetnosy: + python-dev
messages: + msg245828
2015年06月21日 22:02:30berker.peksagsetnosy: + berker.peksag
messages: + msg245611

assignee: docs@python -> berker.peksag
stage: patch review -> commit review
2015年05月31日 10:45:47martin.pantersetfiles: + urlparse-scheme.patch

components: + Tests
versions: + Python 2.7, Python 3.4, Python 3.5, Python 3.6
keywords: + patch
type: behavior
messages: + msg244531
stage: patch review
2015年03月17日 14:24:08demian.brechtsetnosy: + demian.brecht
messages: + msg238293
2015年03月17日 01:39:41martin.pantercreate

AltStyle によって変換されたページ (->オリジナル) /