diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 33e5dfc61c5e73..b4f71a8b3f64df 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -5,7 +5,6 @@ import itertools import os import pathlib -import platform import posixpath import string import struct @@ -3299,7 +3298,6 @@ def test_malformed_paths(self): 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 @@ def test_unsupported_names(self): 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. diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 9b66a9f054dc6b..4cd44fb1e4a8f0 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -2387,7 +2387,7 @@ def open(self, mode='r', *args, pwd=None, **kwargs): @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 index 00000000000000..e9ad02de8fe610 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-09-04-14-05-02.gh-issue-123693.dNW1IF.rst @@ -0,0 +1 @@ +Use platform-agnostic behavior when computing ``zipfile.Path.name``.