Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Lib/ntpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def isabs(s):

# Join two (or more) paths.
def join(path, *paths):
"""Join two or more pathname components, inserting '\\' as needed.
If any component is an absolute path with a root, all previous path
components will be discarded. If any component is an absolute path without
a root, all previous path components except for the root will be discarded.
An empty last part will result in a path that ends with a separator."""
path = os.fspath(path)
if isinstance(path, bytes):
sep = b'\\'
Expand All @@ -116,7 +121,8 @@ def join(path, *paths):
colon = ':'
try:
if not paths:
path[:0] + sep #23780: Ensure compatible data type even if p is null.
# bpo-23780: Ensure compatible data type even if paths is empty.
path[:0] + sep
result_drive, result_root, result_path = splitroot(path)
for p in map(os.fspath, paths):
p_drive, p_root, p_path = splitroot(p)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a docstring for :func:`os.path.join` on Windows.