Merged revisions 68319 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68319 | antoine.pitrou | 2009-01-04 22:29:23 +0100 (dim., 04 janv. 2009) | 3 lines
Issue #4272: Add an optional argument to the GzipFile constructor to override the timestamp in the gzip stream.
........
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst
index c6f9ef8..fa73bba 100644
--- a/Doc/library/gzip.rst
+++ b/Doc/library/gzip.rst
@@ -24,7 +24,7 @@
The module defines the following items:
-.. class:: GzipFile([filename[, mode[, compresslevel[, fileobj]]]])
+.. class:: GzipFile([filename[, mode[, compresslevel[, fileobj[, mtime]]]]])
Constructor for the :class:`GzipFile` class, which simulates most of the methods
of a file object, with the exception of the :meth:`readinto` and
@@ -52,6 +52,15 @@
level of compression; ``1`` is fastest and produces the least compression, and
``9`` is slowest and produces the most compression. The default is ``9``.
+ The *mtime* argument is an optional numeric timestamp to be written to
+ the stream when compressing. All :program:`gzip`compressed streams are
+ required to contain a timestamp. If omitted or ``None``, the current
+ time is used. This module ignores the timestamp when decompressing;
+ however, some programs, such as :program:`gunzip`\ , make use of it.
+ The format of the timestamp is the same as that of the return value of
+ ``time.time()`` and of the ``st_mtime`` member of the object returned
+ by ``os.stat()``.
+
Calling a :class:`GzipFile` object's :meth:`close` method does not close
*fileobj*, since you might wish to append more material after the compressed
data. This also allows you to pass a :class:`StringIO` object opened for