Issue 23684: urlparse() documentation does not account for default scheme
Issue23684
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) * ![]() |
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) * ![]() |
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) * ![]() |
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) * ![]() |
Date: 2015-06-21 22:02 | |
LGTM. Added a minor question on Rietveld. |
|||
| msg245828 - (view) | Author: Roundup Robot (python-dev) ![]() |
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) ![]() |
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) * ![]() |
Date: 2015-06-25 20:48 | |
Thanks Martin. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:13 | admin | set | github: 67872 |
| 2015-06-25 20:48:04 | berker.peksag | set | status: open -> closed resolution: fixed messages: + msg245830 stage: commit review -> resolved |
| 2015-06-25 20:46:51 | python-dev | set | messages: + msg245829 |
| 2015-06-25 20:39:03 | python-dev | set | nosy:
+ python-dev messages: + msg245828 |
| 2015-06-21 22:02:30 | berker.peksag | set | nosy:
+ berker.peksag messages: + msg245611 assignee: docs@python -> berker.peksag |
| 2015-05-31 10:45:47 | martin.panter | set | files:
+ urlparse-scheme.patch components:
+ Tests |
| 2015-03-17 14:24:08 | demian.brecht | set | nosy:
+ demian.brecht messages: + msg238293 |
| 2015-03-17 01:39:41 | martin.panter | create | |

