mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Raise statement normalization in Lib/.
This commit is contained in:
parent
8b3febef2f
commit
ce36ad8a46
80 changed files with 502 additions and 530 deletions
|
@ -15,12 +15,12 @@ def url2pathname(pathname):
|
|||
#
|
||||
tp = urllib.splittype(pathname)[0]
|
||||
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
|
||||
if pathname[:3] == '///':
|
||||
pathname = pathname[2:]
|
||||
elif pathname[:2] == '//':
|
||||
raise RuntimeError, 'Cannot convert non-local URL to pathname'
|
||||
raise RuntimeError('Cannot convert non-local URL to pathname')
|
||||
components = pathname.split('/')
|
||||
# Remove . and embedded ..
|
||||
i = 0
|
||||
|
@ -53,7 +53,7 @@ def pathname2url(pathname):
|
|||
"""OS-specific conversion from a file system path to a relative URL
|
||||
of the 'file' scheme; not recommended for general use."""
|
||||
if '/' in pathname:
|
||||
raise RuntimeError, "Cannot convert pathname containing slashes"
|
||||
raise RuntimeError("Cannot convert pathname containing slashes")
|
||||
components = pathname.split(':')
|
||||
# Remove empty first and/or last component
|
||||
if components[0] == '':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue