mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Check for all used fd-based functions in shutil.rmdir, closes #15218
This commit is contained in:
parent
0b50bf3ffc
commit
d0f6e0a6e6
2 changed files with 9 additions and 3 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue