Commit 29e6fe7e authored by Raymond Hettinger's avatar Raymond Hettinger

Fix 1698398: Zipfile.printdir() crashed because the format string expected a...

Fix 1698398:  Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object.
parent b7929e9a
...@@ -710,7 +710,7 @@ class ZipFile: ...@@ -710,7 +710,7 @@ class ZipFile:
"""Print a table of contents for the zip file.""" """Print a table of contents for the zip file."""
print "%-46s %19s %12s" % ("File Name", "Modified ", "Size") print "%-46s %19s %12s" % ("File Name", "Modified ", "Size")
for zinfo in self.filelist: for zinfo in self.filelist:
date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size) print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size)
def testzip(self): def testzip(self):
...@@ -961,7 +961,7 @@ class ZipFile: ...@@ -961,7 +961,7 @@ class ZipFile:
the name of the file in the archive.""" the name of the file in the archive."""
if not isinstance(zinfo_or_arcname, ZipInfo): if not isinstance(zinfo_or_arcname, ZipInfo):
zinfo = ZipInfo(filename=zinfo_or_arcname, zinfo = ZipInfo(filename=zinfo_or_arcname,
date_time=time.localtime(time.time())) date_time=time.localtime(time.time())[:6])
zinfo.compress_type = self.compression zinfo.compress_type = self.compression
else: else:
zinfo = zinfo_or_arcname zinfo = zinfo_or_arcname
......
...@@ -363,6 +363,9 @@ Core and builtins ...@@ -363,6 +363,9 @@ Core and builtins
Library Library
------- -------
- Issue #1698398 Zipfile.printdir() crashed because the format string
expected a tuple type of length six instead of time.struct_time object.
- Issue #1780: The Decimal constructor now accepts arbitrary leading - Issue #1780: The Decimal constructor now accepts arbitrary leading
and trailing whitespace when constructing from a string. and trailing whitespace when constructing from a string.
Context.create_decimal no longer accepts trailing newlines. Context.create_decimal no longer accepts trailing newlines.
......
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