From bda57096174e6199c4b012613b535508cb0eeec7 Mon Sep 17 00:00:00 2001 From: ANISAYAK MITRA <266799942+anisayakmitra-in@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:32:34 +0530 Subject: [PATCH] Doc: Clarify os.fspath normalization and resolution behavior Note that os.fspath only extracts the file system representation from a PathLike object (or returns str/bytes unchanged) without performing path normalization, validation, or component resolution. Signed-off-by: ANISAYAK MITRA <266799942+anisayakmitra-in@users.noreply.github.com> --- Doc/library/os.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index fff27b48ae989c..19e70c589f8ef4 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -320,6 +320,13 @@ process and user. returned as long as it is a :class:`str` or :class:`bytes` object. In all other cases, :exc:`TypeError` is raised. + .. note:: + + :func:`!fspath` does not perform any path normalization, validation, or + resolution of components such as ``.``, ``..``, or symbolic links. + Use :func:`os.path.normpath` or :meth:`pathlib.Path.resolve` if path + normalization or resolution is needed. + .. versionadded:: 3.6