[docs] [issue29688] Add support for Path.absolute()
Eryk Sun
report at bugs.python.org
Sat Mar 11 19:47:05 EST 2017
Eryk Sun added the comment:
What's the rationale for not calling self._flavour.pathmod.abspath() to implement absolute()? For example:
>>> p = pathlib.Path('C:/con')
>>> p._flavour.pathmod.abspath(p)
'\\\\.\\con'
>>> p._from_parts((p._flavour.pathmod.abspath(p),), init=False)
WindowsPath('//./con/')
That's almost right except for an unrelated problem that pathlib shouldn't append a trailing slash for \\.\ local device paths. Doing so creates a different path, which may be invalid. \\.\con is a symbolic link to \Device\ConDrv\Console, and adding a trailing backslash after the "Console" filename is invalid. An example where the resulting path is valid but wrong is the volume device \\.\C:, which is a link to something like \Device\HarddiskVolume2. Appending a backslash refers to the root directory of the file system on the volume.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29688>
_______________________________________
More information about the docs
mailing list