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 d15e958

Browse filesBrowse files
authored
[3.11] gh-101566: Sync with zipp 3.14. (GH-102018). (GH-102090)
(cherry picked from commit 36854bb) Backport of bugfix only. Automerge-Triggered-By: GH:jaraco
1 parent 62c0327 commit d15e958
Copy full SHA for d15e958

File tree

Expand file treeCollapse file tree

3 files changed

+25
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+25
-0
lines changed

‎Lib/test/test_zipfile.py

Copy file name to clipboardExpand all lines: Lib/test/test_zipfile.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,6 +3339,17 @@ def test_inheritance(self, alpharep):
33393339
file = cls(alpharep).joinpath('some dir').parent
33403340
assert isinstance(file, cls)
33413341

3342+
@pass_alpharep
3343+
def test_extract_orig_with_implied_dirs(self, alpharep):
3344+
"""
3345+
A zip file wrapped in a Path should extract even with implied dirs.
3346+
"""
3347+
source_path = self.zipfile_ondisk(alpharep)
3348+
zf = zipfile.ZipFile(source_path)
3349+
# wrap the zipfile for its side effect
3350+
zipfile.Path(zf)
3351+
zf.extractall(source_path.parent)
3352+
33423353

33433354
class EncodedMetadataTests(unittest.TestCase):
33443355
file_names = ['\u4e00', '\u4e8c', '\u4e09'] # Han 'one', 'two', 'three'

‎Lib/zipfile.py

Copy file name to clipboardExpand all lines: Lib/zipfile.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,6 +2250,17 @@ def resolve_dir(self, name):
22502250
dir_match = name not in names and dirname in names
22512251
return dirname if dir_match else name
22522252

2253+
def getinfo(self, name):
2254+
"""
2255+
Supplement getinfo for implied dirs.
2256+
"""
2257+
try:
2258+
return super().getinfo(name)
2259+
except KeyError:
2260+
if not name.endswith('/') or name not in self._name_set():
2261+
raise
2262+
return ZipInfo(filename=name)
2263+
22532264
@classmethod
22542265
def make(cls, source):
22552266
"""
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
In zipfile, apply
2+
fix for extractall on the underlying zipfile after being wrapped in
3+
``Path``.

0 commit comments

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