https://github.com/python/cpython/commit/947aa707c1703254eceb9bab9d412f36fdb87977
commit: 947aa707c1703254eceb9bab9d412f36fdb87977
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-06-08T18:16:44Z
summary:

[3.13] gh-150368: Change Windows user group to secure identifier in 
test_tempfile (GH-150369) (#150703)

gh-150368: Change Windows user group to secure identifier in test_tempfile 
(GH-150369)
(cherry picked from commit 9d64c355b5471e2d27e036d3662e97567d259c61)

Co-authored-by: Dawid Konrad Kohnke <[email protected]>

files:
M Lib/test/test_tempfile.py

diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 290b8d7a8e7318..e636f45a470602 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -336,7 +336,9 @@ def test_read_only_directory(self):
         with _inside_empty_temp_dir():
             probe = os.path.join(tempfile.tempdir, 'probe')
             if os.name == 'nt':
-                cmd = ['icacls', tempfile.tempdir, '/deny', 'Everyone:(W)']
+                # Use security identifier *S-1-1-0 instead
+                # of localized "Everyone" to not depend on the locale.
+                cmd = ['icacls', tempfile.tempdir, '/deny', '*S-1-1-0:(W)']
                 stdout = None if support.verbose > 1 else subprocess.DEVNULL
                 subprocess.run(cmd, check=True, stdout=stdout)
             else:
@@ -359,7 +361,9 @@ def test_read_only_directory(self):
                     self.make_temp()
             finally:
                 if os.name == 'nt':
-                    cmd = ['icacls', tempfile.tempdir, '/grant:r', 
'Everyone:(M)']
+                    # Use security identifier *S-1-1-0 instead
+                    # of localized "Everyone" to not depend on the locale.
+                    cmd = ['icacls', tempfile.tempdir, '/grant:r', 
'*S-1-1-0:(M)']
                     subprocess.run(cmd, check=True, stdout=stdout)
                 else:
                     os.chmod(tempfile.tempdir, oldmode)

_______________________________________________
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