mirror of
https://github.com/python/cpython.git
synced 2025-08-10 20:08:47 +00:00
Issue #5117: Fixed root directory related issue on posixpath.relpath() and
ntpath.relpath().
This commit is contained in:
parent
0491047580
commit
50f7d7e213
5 changed files with 26 additions and 4 deletions
|
@ -403,8 +403,8 @@ def relpath(path, start=curdir):
|
|||
if not path:
|
||||
raise ValueError("no path specified")
|
||||
|
||||
start_list = abspath(start).split(sep)
|
||||
path_list = abspath(path).split(sep)
|
||||
start_list = [x for x in abspath(start).split(sep) if x]
|
||||
path_list = [x for x in abspath(path).split(sep) if x]
|
||||
|
||||
# Work out how much of the filepath is shared by start and path.
|
||||
i = len(commonprefix([start_list, path_list]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue