https://github.com/python/cpython/commit/9777e8a67776ce225bfa594b4aedae0f18d2e3be
commit: 9777e8a67776ce225bfa594b4aedae0f18d2e3be
branch: main
author: Vasiliy Kiryanov <[email protected]>
committer: encukou <[email protected]>
date: 2026-09-22T13:48:38+02:00
summary:

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

files:
M Lib/test/test_shutil.py

diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index 06ebdf9b68f20f..a7825adf923c19 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -552,11 +552,7 @@ def raiser(fn, *args, **kwargs):
             os.lstat = orig_lstat
 
     def test_rmtree_uses_safe_fd_version_if_available(self):
-        _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:
+        if shutil._use_fd_functions:
             self.assertTrue(shutil.rmtree.avoids_symlink_attacks)
             tmp_dir = self.mkdtemp()
             d = os.path.join(tmp_dir, 'a')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to