mirror of
https://github.com/python/cpython.git
synced 2025-08-22 09:45:06 +00:00
Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object.
This commit is contained in:
parent
b9c741c43c
commit
665ddc9bb3
2 changed files with 5 additions and 2 deletions
|
@ -445,7 +445,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):
|
||||||
|
@ -606,7 +606,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
|
||||||
|
|
|
@ -414,6 +414,9 @@ Extension Modules
|
||||||
|
|
||||||
- Bug #1653736: Fix signature of time_isoformat.
|
- Bug #1653736: Fix signature of time_isoformat.
|
||||||
|
|
||||||
|
- Issue #1698398 Zipfile.printdir() crashed because the format string
|
||||||
|
expected a tuple type of length six instead of time.struct_time object.
|
||||||
|
|
||||||
- operator.count() now raises an OverflowError when the count reaches sys.maxint.
|
- operator.count() now raises an OverflowError when the count reaches sys.maxint.
|
||||||
|
|
||||||
- Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
|
- Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue