bpo-34898: Add mtime parameter to gzip.compress(). (GH-9704)
Without setting mtime, time.time() will be used as the timestamp which will
end up in the compressed data and each invocation of the compress() function
will vary over time.
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index a57307b..8850a33 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -157,13 +157,15 @@
Accepts a :term:`path-like object`.
-.. function:: compress(data, compresslevel=9)
+.. function:: compress(data, compresslevel=9, *, mtime=None)
Compress the *data*, returning a :class:`bytes` object containing
- the compressed data. *compresslevel* has the same meaning as in
+ the compressed data. *compresslevel* and *mtime* have the same meaning as in
the :class:`GzipFile` constructor above.
.. versionadded:: 3.2
+ .. versionchanged:: 3.8
+ Added the *mtime* parameter for reproducible output.
.. function:: decompress(data)