Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(732)

Unified Diff: Lib/urllib/parse.py

Issue 14072: urlparse on tel: URI-s misses the scheme in some cases
Patch Set: Created 1 year ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_urlparse.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -345,12 +345,12 @@
if c not in scheme_chars:
break
else:
- try:
- # make sure "url" is not actually a port number (in which case
- # "scheme" is really part of the path
- _testportnum = int(url[i+1:])
- except ValueError:
- scheme, url = url[:i].lower(), url[i+1:]
+ # make sure "url" is not actually a port number (in which case
+ # "scheme" is really part of the path)
+ rest = url[i+1:]
+ if not rest or any(c not in '0123456789' for c in rest):
+ # not a port number
+ scheme, url = url[:i].lower(), rest
if url[:2] == '//':
netloc, url = _splitnetloc(url, 2)
« no previous file with comments | « Lib/test/test_urlparse.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7