Amend the collapsing the leading slashes to account for the POSIX special case of two leading slashes.
Thanks to Daniel Colascione for noticing.
This commit is contained in:
parent
2e8f456d88
commit
3b72e78196
16
pep-0428.txt
16
pep-0428.txt
|
@ -292,19 +292,29 @@ Extraneous path separators and ``"."`` components are eliminated, but not
|
|||
PurePosixPath('a/../b')
|
||||
|
||||
Multiple leading slashes are treated differently depending on the path
|
||||
flavour::
|
||||
flavour. They are always retained on Windows paths (because of the UNC
|
||||
notation)::
|
||||
|
||||
>>> PurePosixPath('//some/path')
|
||||
PurePosixPath('/some/path')
|
||||
>>> PureNTPath('//some/path')
|
||||
PureNTPath('\\\\some\\path\\')
|
||||
|
||||
On POSIX, they are collapsed except if there are exactly two leading slashes,
|
||||
which is a special case in the POSIX specification on `pathname resolution`_
|
||||
(this is also necessary for Cygwin compatibility)::
|
||||
|
||||
>>> PurePosixPath('///some/path')
|
||||
PurePosixPath('/some/path')
|
||||
>>> PurePosixPath('//some/path')
|
||||
PurePosixPath('//some/path')
|
||||
|
||||
Calling the constructor without any argument creates a path object pointing
|
||||
to the logical "current directory"::
|
||||
|
||||
>>> PurePosixPath()
|
||||
PurePosixPath('.')
|
||||
|
||||
.. _pathname resolution: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap04.html#tag_04_11
|
||||
|
||||
|
||||
Representing
|
||||
------------
|
||||
|
|
Loading…
Reference in New Issue