Commit 67f87065 authored by Victor Stinner's avatar Victor Stinner

Issue #19629: Fix support.rmtree(), use os.lstat() to check if the file is a

directory, not os.path.isdir()
parent 0dee8ad5
......@@ -316,7 +316,13 @@ if sys.platform.startswith("win"):
def _rmtree_inner(path):
for name in os.listdir(path):
fullname = os.path.join(path, name)
if os.path.isdir(fullname):
try:
mode = os.lstat(fullname).st_mode
except OSError as exc:
print("support.rmtree(): os.lstat(%r) failed with %s" % (fullname, exc),
file=sys.__stderr__)
mode = 0
if stat.S_ISDIR(mode):
_waitfor(_rmtree_inner, fullname, waitall=True)
os.rmdir(fullname)
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment