[issue37686] No error message in joining two root directories
Eryk Sun
report at bugs.python.org
Fri Jul 26 02:31:25 EDT 2019
Eryk Sun <eryksun at gmail.com> added the comment:
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.
----------
components: +Library (Lib) -Extension Modules
nosy: +eryksun
resolution: -> not a bug
stage: -> resolved
status: open -> closed
type: -> behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37686>
_______________________________________
More information about the Python-bugs-list
mailing list