Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Undo premature optimisation
  • Loading branch information
barneygale committed May 29, 2024
commit 3b1b15e3024b2f7460bdeb3b9737cd536fcf3b3a
6 changes: 2 additions & 4 deletions Lib/shutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,18 +611,16 @@ def onerror(err):
onexc(os.scandir, err.filename, err)
results = os.walk(path, topdown=False, onerror=onerror, followlinks=os._walk_symlinks_as_files)
for dirpath, dirnames, filenames in results:
# Add trailing slash to dirpath.
dirpath = os.path.join(dirpath, dirpath[:0])
for name in dirnames:
fullname = dirpath + name
fullname = os.path.join(dirpath, name)
try:
os.rmdir(fullname)
except FileNotFoundError:
continue
except OSError as err:
onexc(os.rmdir, fullname, err)
for name in filenames:
fullname = dirpath + name
fullname = os.path.join(dirpath, name)
try:
os.unlink(fullname)
except FileNotFoundError:
Expand Down