]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.10] gh-123693: Use platform-agnostic semantics when processing zipfile.Path.name...
authorJason R. Coombs <jaraco@jaraco.com>
Thu, 5 Sep 2024 09:15:03 +0000 (05:15 -0400)
committerGitHub <noreply@github.com>
Thu, 5 Sep 2024 09:15:03 +0000 (11:15 +0200)
Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78d328c2f575e0b05b16fe447d1656d6)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Lib/test/test_zipfile.py
Lib/zipfile.py
Misc/NEWS.d/next/Library/2024-09-04-14-05-02.gh-issue-123693.dNW1IF.rst [new file with mode: 0644]

index 33e5dfc61c5e73f3d8e332c5e120bc4440f0f02a..b4f71a8b3f64df1dceca6b6af4d0fbc6b18cbb14 100644 (file)
@@ -5,7 +5,6 @@ import io
 import itertools
 import os
 import pathlib
-import platform
 import posixpath
 import string
 import struct
@@ -3299,7 +3298,6 @@ with zipfile.ZipFile(io.BytesIO(), "w") as zf:
         assert list(map(str, root.iterdir())) == ['../']
         assert root.joinpath('..').joinpath('parent.txt').read_bytes() == b'content'
 
-    @unittest.skipIf(platform.system() == "Windows", "GH-123693")
     def test_unsupported_names(self):
         """
         Path segments with special characters are readable.
@@ -3320,7 +3318,6 @@ with zipfile.ZipFile(io.BytesIO(), "w") as zf:
         assert item.name == 'V: NMS.flac', item.name
         assert root.joinpath('V: NMS.flac').read_bytes() == b"fLaC..."
 
-    @unittest.skipIf(platform.system() == "Windows", "GH-123693")
     def test_backslash_not_separator(self):
         """
         In a zip file, backslashes are not separators.
index 9b66a9f054dc6b218e90426b6c7d82fff94c8521..4cd44fb1e4a8f0a3774f4a18ad30d4a41ab08e3d 100644 (file)
@@ -2387,7 +2387,7 @@ class Path:
 
     @property
     def name(self):
-        return pathlib.Path(self.at).name or self.filename.name
+        return pathlib.PurePosixPath(self.at).name or self.filename.name
 
     @property
     def filename(self):
diff --git a/Misc/NEWS.d/next/Library/2024-09-04-14-05-02.gh-issue-123693.dNW1IF.rst b/Misc/NEWS.d/next/Library/2024-09-04-14-05-02.gh-issue-123693.dNW1IF.rst
new file mode 100644 (file)
index 0000000..e9ad02d
--- /dev/null
@@ -0,0 +1 @@
+Use platform-agnostic behavior when computing ``zipfile.Path.name``.