diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-12 15:07:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 15:07:46 (GMT) |
commit | 443db64f496d3988d20cfda2c3c2ceb6702df36f (patch) | |
tree | 02d653e2af0d51035c3f952b8ee3a6be8f43c7d4 | |
parent | 42da46ed522157b057d73e6b623615ef6427999e (diff) | |
download | cpython-443db64f496d3988d20cfda2c3c2ceb6702df36f.zip cpython-443db64f496d3988d20cfda2c3c2ceb6702df36f.tar.gz cpython-443db64f496d3988d20cfda2c3c2ceb6702df36f.tar.bz2 |
bpo-26329: update os.path.normpath documentation (GH-20138) (GH-27094)
(cherry picked from commit 66c5853406bbcccecf35372795078c0641a5f385)
Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
-rw-r--r-- | Doc/library/os.path.rst | 8 | ||||
-rw-r--r-- | Lib/posixpath.py | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst index d06d9ce..e2f4342 100644 --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -340,6 +340,14 @@ the :mod:`glob` module.) that contains symbolic links. On Windows, it converts forward slashes to backward slashes. To normalize case, use :func:`normcase`. + .. note:: + On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13 + Pathname Resolution <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_, + if a pathname begins with exactly two slashes, the first component + following the leading characters may be interpreted in an implementation-defined + manner, although more than two leading characters shall be treated as a + single character. + .. versionchanged:: 3.6 Accepts a :term:`path-like object`. diff --git a/Lib/posixpath.py b/Lib/posixpath.py index 259baa6..1953746 100644 --- a/Lib/posixpath.py +++ b/Lib/posixpath.py @@ -352,6 +352,7 @@ def normpath(path): initial_slashes = path.startswith(sep) # POSIX allows one or two initial slashes, but treats three or more # as single slash. + # (see http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13) if (initial_slashes and path.startswith(sep*2) and not path.startswith(sep*3)): initial_slashes = 2 |