]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-26329: update os.path.normpath documentation (GH-20138) (#27095)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 12 Jul 2021 15:22:33 +0000 (08:22 -0700)
committerGitHub <noreply@github.com>
Mon, 12 Jul 2021 15:22:33 +0000 (17:22 +0200)
(cherry picked from commit 66c5853406bbcccecf35372795078c0641a5f385)

Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
Doc/library/os.path.rst
Lib/posixpath.py

index d2fe4943524533623d488f85d346545a1c4c15fd..3be513e9099c787efd7abf7e6967475dc9b54461 100644 (file)
@@ -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`.
 
index ecb4e5a8f7072c52effe4606b7406190a2dd7787..af2814bdb0580410c25a2920b6a8b86a64d45042 100644 (file)
@@ -349,6 +349,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