seps = '\\/'
colon_seps = ':\\/'
try:
- if not paths:
- path[:0] + sep #23780: Ensure compatible data type even if p is null.
result_drive, result_root, result_path = splitroot(path)
for p in paths:
p_drive, p_root, p_path = splitroot(p)
sep = _get_sep(a)
path = a
try:
- if not p:
- path[:0] + sep #23780: Ensure compatible data type even if p is null.
for b in p:
b = os.fspath(b)
- if b.startswith(sep):
+ if b.startswith(sep) or not path:
path = b
- elif not path or path.endswith(sep):
+ elif path.endswith(sep):
path += b
else:
path += sep + b
self.assertEqual(fn(b"/foo", b"bar", b"baz"), b"/foo/bar/baz")
self.assertEqual(fn(b"/foo/", b"bar/", b"baz/"), b"/foo/bar/baz/")
+ self.assertEqual(fn("a", ""), "a/")
+ self.assertEqual(fn("a", "", ""), "a/")
self.assertEqual(fn("a", "b"), "a/b")
self.assertEqual(fn("a", "b/"), "a/b/")
self.assertEqual(fn("a/", "b"), "a/b")