]> granicus.if.org Git - python/commitdiff
Fix 1698398: Zipfile.printdir() crashed because the format string expected a tuple...
authorRaymond Hettinger <python@rcn.com>
Mon, 14 Jan 2008 23:02:51 +0000 (23:02 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 14 Jan 2008 23:02:51 +0000 (23:02 +0000)
Lib/zipfile.py
Misc/NEWS

index 5c3fff3e74ed32c6e248f7b950415cfdb80b6452..3c7b431015126947930a8b7d4bc3cfcacc5208e1 100644 (file)
@@ -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
index 1e742fb374089258578d884e096262e38b1f4351..04aa21fccf40f5eb07352f874a1bdea79f030a61 100644 (file)
--- 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.