diff options
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 33fcfb1..b812a82 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -776,10 +776,13 @@ class ZipFile: else: zef_file = open(self.filename, 'rb') - # Get info object for name - zinfo = self.getinfo(name) - - filepos = zef_file.tell() + # Make sure we have an info object + if isinstance(name, ZipInfo): + # 'name' is already an info object + zinfo = name + else: + # Get info object for name + zinfo = self.getinfo(name) zef_file.seek(zinfo.header_offset, 0) @@ -884,7 +887,7 @@ class ZipFile: if upperdirs and not os.path.exists(upperdirs): os.makedirs(upperdirs) - source = self.open(member.filename, pwd=pwd) + source = self.open(member, pwd=pwd) target = file(targetpath, "wb") shutil.copyfileobj(source, target) source.close() |