summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-01-17 14:17:48 (GMT)
committerGitHub <noreply@github.com>2020-01-17 14:17:48 (GMT)
commit1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e (patch)
treea8900b44518559521a9613fed4f71dce6422722f /Lib/zipfile.py
parent10fd6b2b9f0aeb8f5a0ce4cb4b9f21f942d39a71 (diff)
downloadcpython-1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e.zip
cpython-1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e.tar.gz
cpython-1d3b0aaa54c56282c0a3e7fc396e5b1de8b1974e.tar.bz2
bpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027)
Remove old "except DeprecationWarning:" code path added by commit bf02e3bb21b2d75cba4ce409a14ae64dbc2dd6d2. It's no longer needed. struct.pack() no longer emit DeprecationWarning if getting a float whereas an integer is expected. It now raises an hard error instead.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index e1d07f2..2da87ef 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1867,25 +1867,15 @@ class ZipFile:
extract_version = max(min_version, zinfo.extract_version)
create_version = max(min_version, zinfo.create_version)
- try:
- filename, flag_bits = zinfo._encodeFilenameFlags()
- centdir = struct.pack(structCentralDir,
- stringCentralDir, create_version,
- zinfo.create_system, extract_version, zinfo.reserved,
- flag_bits, zinfo.compress_type, dostime, dosdate,
- zinfo.CRC, compress_size, file_size,
- len(filename), len(extra_data), len(zinfo.comment),
- 0, zinfo.internal_attr, zinfo.external_attr,
- header_offset)
- except DeprecationWarning:
- print((structCentralDir, stringCentralDir, create_version,
- zinfo.create_system, extract_version, zinfo.reserved,
- zinfo.flag_bits, zinfo.compress_type, dostime, dosdate,
- zinfo.CRC, compress_size, file_size,
- len(zinfo.filename), len(extra_data), len(zinfo.comment),
- 0, zinfo.internal_attr, zinfo.external_attr,
- header_offset), file=sys.stderr)
- raise
+ filename, flag_bits = zinfo._encodeFilenameFlags()
+ centdir = struct.pack(structCentralDir,
+ stringCentralDir, create_version,
+ zinfo.create_system, extract_version, zinfo.reserved,
+ flag_bits, zinfo.compress_type, dostime, dosdate,
+ zinfo.CRC, compress_size, file_size,
+ len(filename), len(extra_data), len(zinfo.comment),
+ 0, zinfo.internal_attr, zinfo.external_attr,
+ header_offset)
self.fp.write(centdir)
self.fp.write(filename)
self.fp.write(extra_data)