diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-11 11:29:28 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-02-11 11:29:28 (GMT) |
commit | 06c45e6e9c9e199a39b874338fe7cdd21d1925b2 (patch) | |
tree | a0882f370fb890b831ad825a8d80a4a14e4098fa /Lib | |
parent | 94a619d48b90aba5b5b42004e84b290bb68f0664 (diff) | |
download | cpython-06c45e6e9c9e199a39b874338fe7cdd21d1925b2.zip cpython-06c45e6e9c9e199a39b874338fe7cdd21d1925b2.tar.gz cpython-06c45e6e9c9e199a39b874338fe7cdd21d1925b2.tar.bz2 |
Issue #25995: os.walk() no longer uses FDs proportional to the tree depth.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/os.py | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -369,22 +369,13 @@ def walk(top, topdown=True, onerror=None, followlinks=False): # Note that scandir is global in this module due # to earlier import-*. scandir_it = scandir(top) + entries = list(scandir(top)) except OSError as error: if onerror is not None: onerror(error) return - while True: - try: - try: - entry = next(scandir_it) - except StopIteration: - break - except OSError as error: - if onerror is not None: - onerror(error) - return - + for entry in entries: try: is_dir = entry.is_dir() except OSError: |