Skip to content

Commit 284fc01

Browse files
committed
fix: scanny#990 Turn off ZipFile strict_timestamps
Accommodate system dates before 1980-01-01. This should have no effect for users with "normal" system clocks but allows the package to save files in the unusual case the system clock is set to a date prior to 1980.
1 parent 799b214 commit 284fc01

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

HISTORY.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
Release History
44
---------------
55

6-
0.6.24-dev0
6+
0.6.24-dev3
77
+++++++++++++++++++
88

99
- fix: #943 remove mention of a Px Length subtype
10+
- fix: #972 next-slide-id fails in rare cases
11+
- fix: #990 do not require strict timestamps for Zip
1012

1113
0.6.23 (2023-11-02)
1214
+++++++++++++++++++

src/pptx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
if TYPE_CHECKING:
2626
from pptx.opc.package import Part
2727

28-
__version__ = "0.6.23"
28+
__version__ = "0.6.24-dev3"
2929

3030
sys.modules["pptx.exceptions"] = exceptions
3131
del sys

src/pptx/opc/serialized.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ def write(self, pack_uri: PackURI, blob: bytes) -> None:
239239
@lazyproperty
240240
def _zipf(self) -> zipfile.ZipFile:
241241
"""`ZipFile` instance open for writing."""
242-
return zipfile.ZipFile(self._pkg_file, "w", compression=zipfile.ZIP_DEFLATED)
242+
return zipfile.ZipFile(
243+
self._pkg_file, "w", compression=zipfile.ZIP_DEFLATED, strict_timestamps=False
244+
)
243245

244246

245247
class _ContentTypesItem:

tests/opc/test_serialized.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ def it_provides_access_to_the_open_zip_file_to_help(self, request: FixtureReques
341341

342342
zipf = pkg_writer._zipf
343343

344-
ZipFile_.assert_called_once_with("prs.pptx", "w", compression=zipfile.ZIP_DEFLATED)
344+
ZipFile_.assert_called_once_with(
345+
"prs.pptx", "w", compression=zipfile.ZIP_DEFLATED, strict_timestamps=False
346+
)
345347
assert zipf is ZipFile_.return_value
346348

347349
# fixtures ---------------------------------------------

0 commit comments

Comments
 (0)