mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
Issue #5117: Case normalization was needed on ntpath.relpath(). And
fixed root directory issue on posixpath.relpath(). (Ported working fixes from ntpath)
This commit is contained in:
parent
08654e18ee
commit
b08820ad40
5 changed files with 27 additions and 4 deletions
|
@ -616,7 +616,7 @@ def relpath(path, start=curdir):
|
|||
path_abs = abspath(normpath(path))
|
||||
start_drive, start_rest = splitdrive(start_abs)
|
||||
path_drive, path_rest = splitdrive(path_abs)
|
||||
if start_drive != path_drive:
|
||||
if normcase(start_drive) != normcase(path_drive):
|
||||
error = "path is on mount '{0}', start on mount '{1}'".format(
|
||||
path_drive, start_drive)
|
||||
raise ValueError(error)
|
||||
|
@ -626,7 +626,7 @@ def relpath(path, start=curdir):
|
|||
# Work out how much of the filepath is shared by start and path.
|
||||
i = 0
|
||||
for e1, e2 in zip(start_list, path_list):
|
||||
if e1 != e2:
|
||||
if normcase(e1) != normcase(e2):
|
||||
break
|
||||
i += 1
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue