Skip to content

Commit 3fc7e27

Browse files
omkar-334miss-islington
authored andcommitted
gh-82907: Document mtime=0 for reproducible tarfile gzip output (GH-150269)
(cherry picked from commit 9df2b6c) Co-authored-by: Omkar Kabde <omkarkabde@gmail.com>
1 parent 3daf1fa commit 3fc7e27

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

Doc/library/tarfile.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ Some facts and figures:
144144

145145
For modes ``'w:gz'`` and ``'w|gz'``, :func:`tarfile.open` accepts the
146146
keyword argument *mtime* to create a gzip archive header with that mtime. By
147-
default, the mtime is set to the time of creation of the archive.
147+
default, the mtime is set to the time of creation of the archive. Use
148+
*mtime* ``0`` to generate a compressed stream that does not depend on
149+
creation time, for reproducible output.
148150

149151
For special purposes, there is a second format for *mode*:
150152
``'filemode|[compression]'``. :func:`tarfile.open` will return a :class:`TarFile`

0 commit comments

Comments
 (0)