Skip to content

Commit 68f093f

Browse files
committed
gh-160904: Correct os.path.normcase documentation for POSIX
os.path.normcase does not do nothing on POSIX: it calls os.fspath, which normalizes path-like objects to str or bytes. Say so in the docstring and in the documentation, instead of claiming that the path is returned unchanged.
1 parent 8a5e24a commit 68f093f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎Doc/library/os.path.rst‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,9 @@ the :mod:`glob` module.)
415415

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

420422
.. versionchanged:: 3.6
421423
Accepts a :term:`path-like object`.

‎Lib/posixpath.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def _get_sep(path):
5252
# (another function should be defined to do that).
5353

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

5859

0 commit comments

Comments
 (0)