diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-12 08:12:48 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-12 08:12:48 (GMT) |
commit | 411bf641d3b820aa5e55718d5c5770543fa32255 (patch) | |
tree | 81032fcaa62c5d7b2d8a1000da92c3fbd4568350 /Lib | |
parent | 91427733ea26a72a987d66db202ed4ddbb95805f (diff) | |
download | cpython-411bf641d3b820aa5e55718d5c5770543fa32255.zip cpython-411bf641d3b820aa5e55718d5c5770543fa32255.tar.gz cpython-411bf641d3b820aa5e55718d5c5770543fa32255.tar.bz2 |
Issue #23605: os.walk() doesn't need to call entry.is_symlink() if followlinks
is True
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/os.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -374,7 +374,10 @@ def walk(top, topdown=True, onerror=None, followlinks=False): if is_dir: dirs.append(entry.name) + else: + nondirs.append(entry.name) + if is_dir and not followlinks: try: if entry.is_symlink(): symlinks.add(entry.name) @@ -383,8 +386,6 @@ def walk(top, topdown=True, onerror=None, followlinks=False): # entry is not a symbolik link, same behaviour than # os.path.islink(). pass - else: - nondirs.append(entry.name) except OSError as error: # scandir() or iterating into scandir() iterator raised an OSError if onerror is not None: |