Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4633177

Browse filesBrowse files
authored
[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 2231286) (cherry picked from commit 17b77bb) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
1 parent 0aa1ee2 commit 4633177
Copy full SHA for 4633177

File tree

Expand file treeCollapse file tree

3 files changed

+2
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+2
-4
lines changed

‎Lib/test/test_zipfile.py

Copy file name to clipboardExpand all lines: Lib/test/test_zipfile.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import itertools
66
import os
77
import pathlib
8-
import platform
98
import posixpath
109
import string
1110
import struct
@@ -3299,7 +3298,6 @@ def test_malformed_paths(self):
32993298
assert list(map(str, root.iterdir())) == ['../']
33003299
assert root.joinpath('..').joinpath('parent.txt').read_bytes() == b'content'
33013300

3302-
@unittest.skipIf(platform.system() == "Windows", "GH-123693")
33033301
def test_unsupported_names(self):
33043302
"""
33053303
Path segments with special characters are readable.
@@ -3320,7 +3318,6 @@ def test_unsupported_names(self):
33203318
assert item.name == 'V: NMS.flac', item.name
33213319
assert root.joinpath('V: NMS.flac').read_bytes() == b"fLaC..."
33223320

3323-
@unittest.skipIf(platform.system() == "Windows", "GH-123693")
33243321
def test_backslash_not_separator(self):
33253322
"""
33263323
In a zip file, backslashes are not separators.

‎Lib/zipfile.py

Copy file name to clipboardExpand all lines: Lib/zipfile.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2387,7 +2387,7 @@ def open(self, mode='r', *args, pwd=None, **kwargs):
23872387

23882388
@property
23892389
def name(self):
2390-
return pathlib.Path(self.at).name or self.filename.name
2390+
return pathlib.PurePosixPath(self.at).name or self.filename.name
23912391

23922392
@property
23932393
def filename(self):
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use platform-agnostic behavior when computing ``zipfile.Path.name``.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.