You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two root directories shall not be joined in the first place. But, when such a command is passed, os.path.join() module should give a warning message instead of just keeping the second argument being passed as the output.
Python 3.7.3 (default, Mar 27 2019, 16:54:48)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
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:
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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: