[3.10] gh-123693: Use platform-agnostic semantics when processing zipfile.Path.name. (#123694)

Applies changes from zipp 3.20.1 and jaraco/zippGH-124
(cherry picked from commit 2231286d78)
(cherry picked from commit 17b77bb)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
This commit is contained in:
Jason R. Coombs 2024-09-05 05:15:03 -04:00 committed by GitHub
parent 0aa1ee22ab
commit 4633177a08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 4 deletions

View 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.

View 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):

View file

@ -0,0 +1 @@
Use platform-agnostic behavior when computing ``zipfile.Path.name``.