summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorMarcel Plch <mplch@redhat.com>2018-08-31 14:43:31 (GMT)
committerVictor Stinner <vstinner@redhat.com>2018-08-31 14:43:31 (GMT)
commit77b112cd56a50232abcdbf28f9aba88dc5d33ad3 (patch)
tree29cc007270c33892d68a5b7dc3b5266e2fc85c2f /Lib/zipfile.py
parent1b5f9c9653f348b0aa8b7ca39f8a9361150f7dfc (diff)
downloadcpython-77b112cd56a50232abcdbf28f9aba88dc5d33ad3.zip
cpython-77b112cd56a50232abcdbf28f9aba88dc5d33ad3.tar.gz
cpython-77b112cd56a50232abcdbf28f9aba88dc5d33ad3.tar.bz2
bpo-34097: Polish API design (GH-8725)
Move strict_timestamps to constructor.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r--Lib/zipfile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index 6da1778..7f23778 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1151,7 +1151,7 @@ class ZipFile:
_windows_illegal_name_trans_table = None
def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=True,
- compresslevel=None):
+ compresslevel=None, *, strict_timestamps=True):
"""Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
or append 'a'."""
if mode not in ('r', 'w', 'x', 'a'):
@@ -1169,6 +1169,7 @@ class ZipFile:
self.mode = mode
self.pwd = None
self._comment = b''
+ self._strict_timestamps = strict_timestamps
# Check if we were passed a file-like object
if isinstance(file, os.PathLike):
@@ -1677,8 +1678,7 @@ class ZipFile:
" would require ZIP64 extensions")
def write(self, filename, arcname=None,
- compress_type=None, compresslevel=None, *,
- strict_timestamps=True):
+ compress_type=None, compresslevel=None):
"""Put the bytes from filename into the archive under the name
arcname."""
if not self.fp:
@@ -1690,7 +1690,7 @@ class ZipFile:
)
zinfo = ZipInfo.from_file(filename, arcname,
- strict_timestamps=strict_timestamps)
+ strict_timestamps=self._strict_timestamps)
if zinfo.is_dir():
zinfo.compress_size = 0