Skip to content

Commit 9777e8a

Browse files
authored
gh-119048: Use shutil._use_fd_functions directly in test (GH-157912)
Use shutil._use_fd_functions in test_rmtree_uses_safe_fd_version_if_available
1 parent c36aa09 commit 9777e8a

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Lib/test/test_shutil.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,7 @@ def raiser(fn, *args, **kwargs):
552552
os.lstat = orig_lstat
553553

554554
def test_rmtree_uses_safe_fd_version_if_available(self):
555-
_use_fd_functions = ({os.open, os.stat, os.unlink, os.rmdir} <=
556-
os.supports_dir_fd and
557-
os.listdir in os.supports_fd and
558-
os.stat in os.supports_follow_symlinks)
559-
if _use_fd_functions:
555+
if shutil._use_fd_functions:
560556
self.assertTrue(shutil.rmtree.avoids_symlink_attacks)
561557
tmp_dir = self.mkdtemp()
562558
d = os.path.join(tmp_dir, 'a')

0 commit comments

Comments
 (0)