mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Fixing Issue6711 - macurl2path has typos that raise AttributeError
This commit is contained in:
parent
044446b67c
commit
8eba090694
1 changed files with 3 additions and 3 deletions
|
@ -13,7 +13,7 @@ def url2pathname(pathname):
|
||||||
#
|
#
|
||||||
# XXXX The .. handling should be fixed...
|
# XXXX The .. handling should be fixed...
|
||||||
#
|
#
|
||||||
tp = urllib.parsesplittype(pathname)[0]
|
tp = urllib.parse.splittype(pathname)[0]
|
||||||
if tp and tp != 'file':
|
if tp and tp != 'file':
|
||||||
raise RuntimeError('Cannot convert non-local URL to pathname')
|
raise RuntimeError('Cannot convert non-local URL to pathname')
|
||||||
# Turn starting /// into /, an empty hostname means current host
|
# Turn starting /// into /, an empty hostname means current host
|
||||||
|
@ -47,7 +47,7 @@ def url2pathname(pathname):
|
||||||
i = i + 1
|
i = i + 1
|
||||||
rv = ':' + ':'.join(components)
|
rv = ':' + ':'.join(components)
|
||||||
# and finally unquote slashes and other funny characters
|
# and finally unquote slashes and other funny characters
|
||||||
return urllib.parseunquote(rv)
|
return urllib.parse.unquote(rv)
|
||||||
|
|
||||||
def pathname2url(pathname):
|
def pathname2url(pathname):
|
||||||
"""OS-specific conversion from a file system path to a relative URL
|
"""OS-specific conversion from a file system path to a relative URL
|
||||||
|
@ -74,7 +74,7 @@ def pathname2url(pathname):
|
||||||
|
|
||||||
def _pncomp2url(component):
|
def _pncomp2url(component):
|
||||||
# We want to quote slashes
|
# We want to quote slashes
|
||||||
return urllib.parsequote(component[:31], safe='')
|
return urllib.parse.quote(component[:31], safe='')
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
for url in ["index.html",
|
for url in ["index.html",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue