Message348468
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. |
|
Date |
User |
Action |
Args |
2019-07-26 06:31:25 | eryksun | set | recipients:
+ eryksun, Bin Hu |
2019-07-26 06:31:25 | eryksun | set | messageid: <1564122685.84.0.869457598206.issue37686@roundup.psfhosted.org> |
2019-07-26 06:31:25 | eryksun | link | issue37686 messages |
2019-07-26 06:31:25 | eryksun | create | |
|