]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-82907: Document mtime=0 for reproducible tarfile gzip output (GH-150269)
authorOmkar Kabde <omkarkabde@gmail.com>
Fri, 22 May 2026 21:02:56 +0000 (02:32 +0530)
committerGitHub <noreply@github.com>
Fri, 22 May 2026 21:02:56 +0000 (21:02 +0000)
Doc/library/tarfile.rst

index 6f1e01cf5aa6ee95aa28241c6b49dc1251b32d72..9b9783d8e58013ff97cf85255e1bdb45bb94cde2 100644 (file)
@@ -144,7 +144,9 @@ Some facts and figures:
 
    For modes ``'w:gz'`` and ``'w|gz'``, :func:`tarfile.open` accepts the
    keyword argument *mtime* to create a gzip archive header with that mtime. By
-   default, the mtime is set to the time of creation of the archive.
+   default, the mtime is set to the time of creation of the archive. Use
+   *mtime* ``0`` to generate a compressed stream that does not depend on
+   creation time, for reproducible output.
 
    For special purposes, there is a second format for *mode*:
    ``'filemode|[compression]'``.  :func:`tarfile.open` will return a :class:`TarFile`