https://github.com/python/cpython/commit/9d603d3c12b8365ef2db26746ec1f21855c98927 commit: 9d603d3c12b8365ef2db26746ec1f21855c98927 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: zooba <[email protected]> date: 2026-07-06T17:23:15Z summary:
[3.15] gh-150880: Clarify DirEntry.path construction semantics (GH-153218) (GH-153219) gh-150880: Clarify DirEntry.path construction semantics (GH-153218) (cherry picked from commit 53661afabd2b4a9c92230ee7024dc42782164f8e) Co-authored-by: Zain Nadeem <[email protected]> files: M Doc/library/os.rst diff --git a/Doc/library/os.rst b/Doc/library/os.rst index fba6ece80e5df5..7dd2333d8dc72e 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3037,10 +3037,16 @@ features: .. attribute:: path - The entry's full path name: equivalent to ``os.path.join(scandir_path, - entry.name)`` where *scandir_path* is the :func:`scandir` *path* - argument. The path is only absolute if the :func:`scandir` *path* - argument was absolute. If the :func:`scandir` *path* + The entry's path name: equivalent to ``os.path.join(scandir_path, + entry.name)`` where *scandir_path* is the original :func:`scandir` + *path* argument. Apart from the filename, the path preserves the + original :func:`scandir` argument. If the :func:`scandir` *path* + argument was relative, the :attr:`path` attribute is also relative. + Changing the current working directory after creating the + :func:`scandir` iterator may cause later uses of :attr:`path` to resolve + differently. On some platforms, the constructed path may not be valid + if the original :func:`scandir` argument was usable for enumeration but + not for joining with the entry name. If the :func:`scandir` *path* argument was a :ref:`file descriptor <path_fd>`, the :attr:`path` attribute is the same as the :attr:`name` attribute. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
