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 Bin Hu, eryksun
Date 2019-07-26.06:31:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1564122685.84.0.869457598206.issue37686@roundup.psfhosted.org>
In-reply-to
Content
The behavior in question is documented as follows: "If a component is an absolute path, all previous components are thrown away and joining continues from the absolute path component."

In Windows, this is extended to support drives and the six file-path types:

Absolute:

    DOS-Drive - C:\spam
    UNC       - \\localhost\C$\spam
    Device    - \\.\C:\spam
              - \\?\C:\spam

Hybrid [1]:

    DOS-Drive - C:spam
    Rooted    - \spam

Relative      - spam

Python extends the notion of a drive to UNC shares and devices [2]. join() handles all components with a drive as absolute. A rooted component that lacks a drive is not absolute, so it replaces only the root path of previous components, not the drive.

---

[1] os.path.isabs mistakenly classifies rooted paths as absolute, but they're relative to the working drive. pathlib.Path.is_absolute gets it right.

[2] There are unresolved issues with device paths. For example, "\\?\C:" is mistakenly handled as a drive-relative path, and the semantics of the "UNC" device and "Global" link aren't implemented.
History
Date User Action Args
2019-07-26 06:31:25eryksunsetrecipients: + eryksun, Bin Hu
2019-07-26 06:31:25eryksunsetmessageid: <1564122685.84.0.869457598206.issue37686@roundup.psfhosted.org>
2019-07-26 06:31:25eryksunlinkissue37686 messages
2019-07-26 06:31:25eryksuncreate