Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-57179: Add note on symlinks for os.walk #94799

Merged
merged 1 commit into from
Oct 7, 2022
Merged
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
3 changes: 2 additions & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3170,7 +3170,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
Expand Down
3 changes: 2 additions & 1 deletion Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down