Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ the :mod:`glob` module.)

Normalize the case of a pathname. On Windows, convert all characters in the
pathname to lowercase, and also convert forward slashes to backward slashes.
On other operating systems, return the path unchanged.
On other operating systems, do not change the case of the path, but
normalize :term:`path-like objects <path-like object>` to :class:`str` or
:class:`bytes`, just like :func:`os.fspath`.

.. versionchanged:: 3.6
Accepts a :term:`path-like object`.
Expand Down
3 changes: 2 additions & 1 deletion Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def _get_sep(path):
# (another function should be defined to do that).

def normcase(s, /):
"""Normalize case of pathname. Has no effect under Posix"""
"""Normalize case of pathname. Does not change the case, but
normalizes path-like objects to str or bytes, like os.fspath"""
return os.fspath(s)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify :func:`os.path.normcase` documentation: on POSIX it normalizes path-like objects via :func:`os.fspath` rather than returning the path unchanged.
Loading