Skip to content

Commit b5bf7e8

Browse files
authored
bpo-29976: urllib.parse clarify '' in scheme values. (GH-984) (GH-1692)
(cherry picked from commit 906f533)
1 parent 564398a commit b5bf7e8

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

Lib/urllib/parse.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,37 @@
3838
"DefragResult", "ParseResult", "SplitResult",
3939
"DefragResultBytes", "ParseResultBytes", "SplitResultBytes"]
4040

41-
# A classification of schemes ('' means apply by default)
42-
uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
41+
# A classification of schemes.
42+
# The empty string classifies URLs with no scheme specified,
43+
# being the default value returned by “urlsplit” and “urlparse”.
44+
45+
uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap',
4346
'wais', 'file', 'https', 'shttp', 'mms',
44-
'prospero', 'rtsp', 'rtspu', '', 'sftp',
47+
'prospero', 'rtsp', 'rtspu', 'sftp',
4548
'svn', 'svn+ssh', 'ws', 'wss']
46-
uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
49+
50+
uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet',
4751
'imap', 'wais', 'file', 'mms', 'https', 'shttp',
48-
'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
52+
'snews', 'prospero', 'rtsp', 'rtspu', 'rsync',
4953
'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh',
5054
'ws', 'wss']
51-
uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
55+
56+
uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap',
5257
'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
53-
'mms', '', 'sftp', 'tel']
58+
'mms', 'sftp', 'tel']
5459

5560
# These are not actually used anymore, but should stay for backwards
5661
# compatibility. (They are undocumented, but have a public-looking name.)
62+
5763
non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
5864
'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
59-
uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
60-
'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
61-
uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
65+
66+
uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms',
67+
'gopher', 'rtsp', 'rtspu', 'sip', 'sips']
68+
69+
uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news',
6270
'nntp', 'wais', 'https', 'shttp', 'snews',
63-
'file', 'prospero', '']
71+
'file', 'prospero']
6472

6573
# Characters valid in scheme names
6674
scheme_chars = ('abcdefghijklmnopqrstuvwxyz'

0 commit comments

Comments
 (0)