mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Prevent convert_path from crashing if the path is an empty string. Bugfix candidate.
This commit is contained in:
parent
efaffae8f6
commit
0b5c11252d
1 changed files with 2 additions and 2 deletions
|
|
@ -84,9 +84,9 @@ def convert_path (pathname):
|
||||||
"""
|
"""
|
||||||
if os.sep == '/':
|
if os.sep == '/':
|
||||||
return pathname
|
return pathname
|
||||||
if pathname[0] == '/':
|
if pathname and pathname[0] == '/':
|
||||||
raise ValueError, "path '%s' cannot be absolute" % pathname
|
raise ValueError, "path '%s' cannot be absolute" % pathname
|
||||||
if pathname[-1] == '/':
|
if pathname and pathname[-1] == '/':
|
||||||
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
raise ValueError, "path '%s' cannot end with '/'" % pathname
|
||||||
|
|
||||||
paths = string.split(pathname, '/')
|
paths = string.split(pathname, '/')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue