Skip to content

Commit e4e7d53

Browse files
Update docs.
1 parent 52acf9e commit e4e7d53

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

Doc/library/gzip.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ The module defines the following items:
112112
*mtime* to ``0`` to generate a compressed stream that does not depend on
113113
creation time. If *mtime* is omitted or ``None``, the current time is used;
114114
however, if the current time is outside the range 00:00:00 UTC, January 1,
115-
1970 through 06:28:15 UTC, February 7, 2106, then the value ``0`` is used
116-
instead.
115+
1970 through 06:28:15 UTC, February 7, 2106, or explicitly passed *mtime*
116+
argument is outside the range ``0`` to ``2**32-1``, then the value ``0``
117+
is used instead.
117118

118119
See below for the :attr:`mtime` attribute that is set when decompressing.
119120

Lib/gzip.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,9 @@ def __init__(self, filename=None, mode=None,
189189
The optional mtime argument is the timestamp requested by gzip. The time
190190
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970.
191191
Set mtime to 0 to generate a compressed stream that does not depend on
192-
creation time. If mtime is omitted or None, the current time is used;
193-
however, if the current time is outside the range 00:00:00 UTC, January
194-
1, 1970 through 06:28:15 UTC, February 7, 2106, then the value 0 is used
195-
instead.
192+
creation time. If mtime is omitted or None, the current time is used.
193+
If the resulting mtime is outside the range 0 to 2**32-1, then the
194+
value 0 is used instead.
196195
197196
"""
198197

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
Fix ``struct.error`` exception when creating a file with ``gzip.GzipFile()`` if the system time is outside the range 00:00:00 UTC, January 1, 1970 through 06:28:15 UTC, February 7, 2106.
1+
Fix :exc:`struct.error` exception when creating a file with
2+
:class:`gzip.GzipFile` or compressing data with :func:`gzip.compress`
3+
if the system time is outside the range 00:00:00 UTC, January 1, 1970
4+
through 06:28:15 UTC, February 7, 2106, or explicitly passed *mtime*
5+
argument is outside the range ``0`` to ``2**32-1``.

0 commit comments

Comments
 (0)