mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +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
|
@ -524,7 +524,11 @@ class TestShutil(unittest.TestCase):
|
|||
self.assertFalse(os.path.islink(dst))
|
||||
|
||||
def test_rmtree_uses_safe_fd_version_if_available(self):
|
||||
if 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)
|
||||
if _use_fd_functions:
|
||||
self.assertTrue(shutil._use_fd_functions)
|
||||
self.assertTrue(shutil.rmtree.avoids_symlink_attacks)
|
||||
tmp_dir = self.mkdtemp()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue