summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-01-14 23:02:51 +0000
committerRaymond Hettinger <python@rcn.com>2008-01-14 23:02:51 +0000
commit665ddc9bb38d70ddb075654c8747c2ab5c302cf9 (patch)
tree08fa1baa2ab816c5feabb29bade0179e834ab35d
parentb9c741c43cdd08a18120f23cfca81afeaead9820 (diff)
downloadcpython-git-665ddc9bb38d70ddb075654c8747c2ab5c302cf9.tar.gz
Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple object of length six instead of a time.struct_time object.
-rw-r--r--Lib/zipfile.py4
-rw-r--r--Misc/NEWS3
2 files changed, 5 insertions, 2 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 5c3fff3e74..3c7b431015 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -445,7 +445,7 @@ class ZipFile:
"""Print a table of contents for the zip file."""
print "%-46s %19s %12s" % ("File Name", "Modified ", "Size")
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)
def testzip(self):
@@ -606,7 +606,7 @@ class ZipFile:
the name of the file in the archive."""
if not isinstance(zinfo_or_arcname, ZipInfo):
zinfo = ZipInfo(filename=zinfo_or_arcname,
- date_time=time.localtime(time.time()))
+ date_time=time.localtime(time.time())[:6])
zinfo.compress_type = self.compression
else:
zinfo = zinfo_or_arcname
diff --git a/Misc/NEWS b/Misc/NEWS
index 1e742fb374..04aa21fccf 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -414,6 +414,9 @@ Extension Modules
- 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.
- Bug #1575169: operator.isSequenceType() now returns False for subclasses of dict.