[Python-checkins] gh-57179: Add note on symlinks for os.walk (GH-94799)

miss-islington webhook-mailer at python.org
Fri Oct 7 23:00:10 EDT 2022


https://github.com/python/cpython/commit/8d6591b593e05e9d00f74f444b3c040905450548
commit: 8d6591b593e05e9d00f74f444b3c040905450548
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-10-07T20:00:04-07:00
summary:

gh-57179: Add note on symlinks for os.walk (GH-94799)

(cherry picked from commit 0f498f1a95306995ca1e287f552c5c3d856be02d)

Co-authored-by: Stanley <46876382+slateny at users.noreply.github.com>

files:
M Doc/library/os.rst
M Lib/os.py

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index fbfeeb2d7e1f..833779166910 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -3208,7 +3208,8 @@ features:
    filenames)``.
 
    *dirpath* is a string, the path to the directory.  *dirnames* is a list of the
-   names of the subdirectories in *dirpath* (excluding ``'.'`` and ``'..'``).
+   names of the subdirectories in *dirpath* (including symlinks to directories,
+   and excluding ``'.'`` and ``'..'``).
    *filenames* is a list of the names of the non-directory files in *dirpath*.
    Note that the names in the lists contain no path components.  To get a full path
    (which begins with *top*) to a file or directory in *dirpath*, do
diff --git a/Lib/os.py b/Lib/os.py
index 648188e0f134..fd1e774fdcbc 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -288,7 +288,8 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
         dirpath, dirnames, filenames
 
     dirpath is a string, the path to the directory.  dirnames is a list of
-    the names of the subdirectories in dirpath (excluding '.' and '..').
+    the names of the subdirectories in dirpath (including symlinks to directories,
+    and excluding '.' and '..').
     filenames is a list of the names of the non-directory files in dirpath.
     Note that the names in the lists are just names, with no path components.
     To get a full path (which begins with top) to a file or directory in



More information about the Python-checkins mailing list