Issue #5117: Fixed root directory related issue on posixpath.relpath() and
ntpath.relpath().
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 81f25b8..aae38d5 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -403,8 +403,8 @@
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]))