Skip to content

Commit

Permalink
bpo-26329: update os.path.normpath documentation (pythonGH-20138)
Browse files Browse the repository at this point in the history
* bpo-26329: update os.path.normpath documentation

* Update os.path.rst

* Update posixpath.py

* update Pathname Resolution note
  • Loading branch information
furkanonder authored Jul 12, 2021
1 parent 171d529 commit 66c5853
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand Down
1 change: 1 addition & 0 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 66c5853

Please sign in to comment.