Message298313
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. |
|
Date |
User |
Action |
Args |
2017-07-13 20:16:14 | eryksun | set | recipients:
+ eryksun, paul.moore, eric.smith, tim.golden, zach.ware, serhiy.storchaka, mesheb82, steve.dower |
2017-07-13 20:16:14 | eryksun | set | messageid: <1499976974.85.0.66678407476.issue30906@psf.upfronthosting.co.za> |
2017-07-13 20:16:14 | eryksun | link | issue30906 messages |
2017-07-13 20:16:14 | eryksun | create | |
|