[Python-checkins] bpo-45114: Use lstat() instead of stat() in stat docs example (GH-29845)

miss-islington webhook-mailer at python.org
Sat Apr 2 17:21:57 EDT 2022


https://github.com/python/cpython/commit/dc9322a91d48c80afe8329bb509673a2f74fb925
commit: dc9322a91d48c80afe8329bb509673a2f74fb925
branch: 3.9
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-04-02T14:21:45-07:00
summary:

bpo-45114: Use lstat() instead of stat() in stat docs example (GH-29845)

(cherry picked from commit c93a0ac6972221787d8bea1c41a9feb667ed3d2c)

Co-authored-by: 180909 <wjh180909 at gmail.com>

files:
M Doc/library/stat.rst

diff --git a/Doc/library/stat.rst b/Doc/library/stat.rst
index 98219eaee9761..083dc5e3bcfd6 100644
--- a/Doc/library/stat.rst
+++ b/Doc/library/stat.rst
@@ -109,7 +109,7 @@ Example::
 
        for f in os.listdir(top):
            pathname = os.path.join(top, f)
-           mode = os.stat(pathname).st_mode
+           mode = os.lstat(pathname).st_mode
            if S_ISDIR(mode):
                # It's a directory, recurse into it
                walktree(pathname, callback)



More information about the Python-checkins mailing list