This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eric.smith, eryksun, mesheb82, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Date 2017-07-13.20:16:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499976974.85.0.66678407476.issue30906@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-07-13 20:16:14eryksunsetrecipients: + eryksun, paul.moore, eric.smith, tim.golden, zach.ware, serhiy.storchaka, mesheb82, steve.dower
2017-07-13 20:16:14eryksunsetmessageid: <1499976974.85.0.66678407476.issue30906@psf.upfronthosting.co.za>
2017-07-13 20:16:14eryksunlinkissue30906 messages
2017-07-13 20:16:14eryksuncreate