diff options
author | Hynek Schlawack <hs@ox.cx> | 2012-06-29 06:28:20 (GMT) |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2012-06-29 06:28:20 (GMT) |
commit | d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c (patch) | |
tree | 7649ea9c2d44d13033d0c46023ced52722e4c3b4 /Lib/shutil.py | |
parent | 0b50bf3ffc8beb8fe808fc2dd17253e8a4794a05 (diff) | |
download | cpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.zip cpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.tar.gz cpython-d0f6e0a6e61d2ded83ddf46db193cf97eb3b878c.tar.bz2 |
Check for all used fd-based functions in shutil.rmdir, closes #15218
Diffstat (limited to 'Lib/shutil.py')
-rw-r--r-- | Lib/shutil.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py index 99e4017..6d80fee 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -405,8 +405,10 @@ def _rmtree_safe_fd(topfd, path, onerror): except os.error: onerror(os.unlink, fullname, sys.exc_info()) -_use_fd_functions = (os.unlink in os.supports_dir_fd and - os.open in os.supports_dir_fd) +_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <= + os.supports_dir_fd and + os.listdir in os.supports_fd and + os.stat in os.supports_follow_symlinks) def rmtree(path, ignore_errors=False, onerror=None): """Recursively delete a directory tree. |