Kaydet (Commit) 95d5c9d5 authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka

Issue #22201: Command-line interface of the zipfile module now correctly

extracts ZIP files with directory entries.  Patch by Ryan Wilson.
...@@ -1764,18 +1764,7 @@ def main(args = None): ...@@ -1764,18 +1764,7 @@ def main(args = None):
sys.exit(1) sys.exit(1)
with ZipFile(args[1], 'r') as zf: with ZipFile(args[1], 'r') as zf:
out = args[2] zf.extractall(args[2])
for path in zf.namelist():
if path.startswith('./'):
tgt = os.path.join(out, path[2:])
else:
tgt = os.path.join(out, path)
tgtdir = os.path.dirname(tgt)
if not os.path.exists(tgtdir):
os.makedirs(tgtdir)
with open(tgt, 'wb') as fp:
fp.write(zf.read(path))
elif args[0] == '-c': elif args[0] == '-c':
if len(args) < 3: if len(args) < 3:
......
...@@ -935,6 +935,9 @@ Tests ...@@ -935,6 +935,9 @@ Tests
Tools/Demos Tools/Demos
----------- -----------
- Issue #22201: Command-line interface of the zipfile module now correctly
extracts ZIP files with directory entries. Patch by Ryan Wilson.
- Issue #22120: For functions using an unsigned integer return converter, - Issue #22120: For functions using an unsigned integer return converter,
Argument Clinic now generates a cast to that type for the comparison Argument Clinic now generates a cast to that type for the comparison
to -1 in the generated code. (This supresses a compilation warning.) to -1 in the generated code. (This supresses a compilation warning.)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment