https://github.com/python/cpython/commit/d9565e54b1fc6d63c5be9afd58114499128fa57b
commit: d9565e54b1fc6d63c5be9afd58114499128fa57b
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-09-11T19:54:41+02:00
summary:

gh-157265: Adjust test for Windows (GH-157334)

gh-157266: Adjust test for Windows

On Windows (no symlinks, no hardlinks), the behaviour is
the same as without the fix in GH-157266:
- a/t/dummy is extracted
- b/ is extracted
- c/ is *not* created (the target, a/t, is not in the archive)
- c/escape: c/ is created; escape is skipped (target,
   c/../../link_here, is not in archive)
- c is not recreated as a directory
- boom is not created (target is c/escape, which falls back to
  ..\..\link_here, which does not exist in archive)

files:
M Lib/test/test_tarfile.py

diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index 598179983a7cbc..55f052d0504d67 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -4621,15 +4621,15 @@ def test_sneaky_hardlink_fallback(self):
         for filter in 'tar', 'fully_trusted':
             with self.subTest(filter), self.check_context(arc.open(), filter):
                 if not os_helper.can_symlink():
-                    if filter == 'tar':
+                    if filter == 'fully_trusted' or sys.platform == "win32":
+                        self.expect_file("a/t/dummy")
+                        self.expect_file("b/")
+                        self.expect_file("c/")
+                    else:
                         self.expect_exception(
                             tarfile.LinkFallbackError,
                             "link 'boom' would be extracted as a copy of "
                             + "'c/escape', which was rejected")
-                    else:
-                        self.expect_file("a/t/dummy")
-                        self.expect_file("b/")
-                        self.expect_file("c/")
                 else:
                     self.expect_file("a/t/dummy")
                     self.expect_file("b/")

_______________________________________________
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