mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[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 commit2231286d78
) (cherry picked from commit17b77bb
) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
This commit is contained in:
parent
0aa1ee22ab
commit
4633177a08
3 changed files with 2 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Use platform-agnostic behavior when computing ``zipfile.Path.name``.
|
Loading…
Add table
Add a link
Reference in a new issue