mirror of https://github.com/python/cpython.git
[3.11] gh-101566: Sync with zipp 3.14. (GH-102018). (GH-102090)
(cherry picked from commit 36854bbb24
)
Backport of bugfix only.
Automerge-Triggered-By: GH:jaraco
This commit is contained in:
parent
62c0327487
commit
d15e9589f3
|
@ -3339,6 +3339,17 @@ def test_inheritance(self, alpharep):
|
|||
file = cls(alpharep).joinpath('some dir').parent
|
||||
assert isinstance(file, cls)
|
||||
|
||||
@pass_alpharep
|
||||
def test_extract_orig_with_implied_dirs(self, alpharep):
|
||||
"""
|
||||
A zip file wrapped in a Path should extract even with implied dirs.
|
||||
"""
|
||||
source_path = self.zipfile_ondisk(alpharep)
|
||||
zf = zipfile.ZipFile(source_path)
|
||||
# wrap the zipfile for its side effect
|
||||
zipfile.Path(zf)
|
||||
zf.extractall(source_path.parent)
|
||||
|
||||
|
||||
class EncodedMetadataTests(unittest.TestCase):
|
||||
file_names = ['\u4e00', '\u4e8c', '\u4e09'] # Han 'one', 'two', 'three'
|
||||
|
|
|
@ -2250,6 +2250,17 @@ def resolve_dir(self, name):
|
|||
dir_match = name not in names and dirname in names
|
||||
return dirname if dir_match else name
|
||||
|
||||
def getinfo(self, name):
|
||||
"""
|
||||
Supplement getinfo for implied dirs.
|
||||
"""
|
||||
try:
|
||||
return super().getinfo(name)
|
||||
except KeyError:
|
||||
if not name.endswith('/') or name not in self._name_set():
|
||||
raise
|
||||
return ZipInfo(filename=name)
|
||||
|
||||
@classmethod
|
||||
def make(cls, source):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
In zipfile, apply
|
||||
fix for extractall on the underlying zipfile after being wrapped in
|
||||
``Path``.
|
Loading…
Reference in New Issue