Eryk Sun added the comment: The difference compared to PathCchCombineEx stems from the following snippet in ntpath.join:
if p_path and p_path[0] in seps: # Second path is absolute if p_drive or not result_drive: result_drive = p_drive result_path = p_path The case that PathCchCombineEx fails is that the second path is rooted [*] but neither UNC nor drive-absolute (i.e. p_drive is empty) and the first path is relative but neither rooted nor drive-relative. When the second path is rooted but not absolute, PathCchCombineEx requires the joined path to use the root of the first path as determined by PathCchStripToRoot. The latter fails for a completely relative path (i.e. no root or drive), as it rightly should. The question is whether the join operation itself should fail because the first path has no root. Python makes a different choice, but it isn't necessarily wrong. [*] Path Type | Example ==================================== Relative | file ---------------|-------------------- Rooted | \file Drive-Relative | C:file ==================================== Drive-Absolute | C:\file UNC | \\server\share\file ==================================== Extended | \\?\C:\file Device | \\.\C: In Windows, rooted paths are relative to the current drive or network share, but Python still classifies them as absolute. In contrast, C++ path::is_absolute() requires both has_root_name and has_root_directory in Windows, so L"\\dir" is classified as a relative path. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30906> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com