diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-21 17:18:12 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-21 17:18:12 (GMT) |
commit | 67f8706521596adcc1a77209d3639e19cfaa65b2 (patch) | |
tree | 3b5e5e7a5b004841f3ef86336c70bbb53e4f018a /Lib/test/support | |
parent | 0dee8ad579c57ee533251004f66f1f4c6fee1691 (diff) | |
download | cpython-67f8706521596adcc1a77209d3639e19cfaa65b2.zip cpython-67f8706521596adcc1a77209d3639e19cfaa65b2.tar.gz cpython-67f8706521596adcc1a77209d3639e19cfaa65b2.tar.bz2 |
Issue #19629: Fix support.rmtree(), use os.lstat() to check if the file is a
directory, not os.path.isdir()
Diffstat (limited to 'Lib/test/support')
-rw-r--r-- | Lib/test/support/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index c1a187d..d321bb4 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -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: |