cpython: 9fda6658c01a (original) (raw)

Mercurial > cpython

changeset 88589:9fda6658c01a 3.3

Issue #20262: Warnings are raised now when duplicate names are added in the ZIP file or too long ZIP file comment is truncated. [#20262]

Serhiy Storchaka storchaka@gmail.com
date Mon, 20 Jan 2014 21:57:40 +0200
parents 5f754f1e3194
children f7cebf727bc6 033137c12d88
files Lib/test/test_zipfile.py Lib/zipfile.py Misc/NEWS
diffstat 3 files changed, 14 insertions(+), 8 deletions(-)[+] [-] Lib/test/test_zipfile.py 7 Lib/zipfile.py 12 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -844,7 +844,9 @@ class OtherTests(unittest.TestCase): # Create the ZIP archive with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp: zipfp.writestr("name", "foo")

with zipfile.ZipFile(TESTFN2, "r") as zipfp: infos = zipfp.infolist() @@ -1150,7 +1152,8 @@ class OtherTests(unittest.TestCase): # check a comment that is too long is truncated with zipfile.ZipFile(TESTFN, mode="w") as zipf:

--- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1102,10 +1102,10 @@ class ZipFile: if not isinstance(comment, bytes): raise TypeError("comment: expected bytes, got %s" % type(comment)) # check for valid comment length

@@ -1290,8 +1290,8 @@ class ZipFile: def _writecheck(self, zinfo): """Check for errors before writing a file to the archive.""" if zinfo.filename in self.NameToInfo:

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -43,6 +43,9 @@ Core and Builtins Library ------- +- Issue #20262: Warnings are raised now when duplicate names are added in the