Skip to content

Commit 5c23952

Browse files
committed
Merge remote-tracking branch 'upstream' into fix-issue-140715--C
2 parents 54bd9c1 + a7d5a6c commit 5c23952

36 files changed

Lines changed: 1270 additions & 873 deletions

Doc/library/difflib.rst

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -728,18 +728,16 @@ Finally, we compare the two:
728728

729729
>>> from pprint import pprint
730730
>>> pprint(result)
731-
[
732-
' 1. Beautiful is better than ugly.\n',
733-
'- 2. Explicit is better than implicit.\n',
734-
'- 3. Simple is better than complex.\n',
735-
'+ 3. Simple is better than complex.\n',
736-
'? ++\n',
737-
'- 4. Complex is better than complicated.\n',
738-
'? ^ ---- ^\n',
739-
'+ 4. Complicated is better than complex.\n',
740-
'? ++++ ^ ^\n',
741-
'+ 5. Flat is better than nested.\n',
742-
]
731+
[' 1. Beautiful is better than ugly.\n',
732+
'- 2. Explicit is better than implicit.\n',
733+
'- 3. Simple is better than complex.\n',
734+
'+ 3. Simple is better than complex.\n',
735+
'? ++\n',
736+
'- 4. Complex is better than complicated.\n',
737+
'? ^ ---- ^\n',
738+
'+ 4. Complicated is better than complex.\n',
739+
'? ++++ ^ ^\n',
740+
'+ 5. Flat is better than nested.\n']
743741

744742
As a single multi-line string it looks like this:
745743

Doc/library/gzip.rst

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Note that additional file formats which can be decompressed by the
2828
The module defines the following items:
2929

3030

31-
.. function:: open(filename, mode='rb', compresslevel=6, encoding=None, errors=None, newline=None)
31+
.. function:: open(filename, mode='rb', compresslevel=6, encoding=None, errors=None, newline=None, *, mtime=None)
3232

3333
Open a gzip-compressed file in binary or text mode, returning a :term:`file
3434
object`.
@@ -43,9 +43,12 @@ The module defines the following items:
4343
The *compresslevel* argument is an integer from 0 to 9, as for the
4444
:class:`GzipFile` constructor.
4545

46+
The keyword-only argument *mtime* represents a Unix timestamp.
47+
4648
For binary mode, this function is equivalent to the :class:`GzipFile`
47-
constructor: ``GzipFile(filename, mode, compresslevel)``. In this case, the
48-
*encoding*, *errors* and *newline* arguments must not be provided.
49+
constructor: ``GzipFile(filename, mode, compresslevel, mtime=mtime)``.
50+
In this case, the *encoding*, *errors* and *newline* arguments must not
51+
be provided.
4952

5053
For text mode, a :class:`GzipFile` object is created, and wrapped in an
5154
:class:`io.TextIOWrapper` instance with the specified encoding, error
@@ -66,6 +69,10 @@ The module defines the following items:
6669
It is the default level used by most compression tools and a better
6770
tradeoff between speed and performance.
6871

72+
.. versionchanged:: next
73+
Added keyword-only argument *mtime* which is passed to the class
74+
constructor of :class:`~gzip.GzipFile`.
75+
6976
.. exception:: BadGzipFile
7077

7178
An exception raised for invalid gzip files. It inherits from :exc:`OSError`.
@@ -108,9 +115,13 @@ The module defines the following items:
108115
is no compression. The default is ``9``.
109116

110117
The optional *mtime* argument is the timestamp requested by gzip. The time
111-
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970.
112-
If *mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0
113-
to generate a compressed stream that does not depend on creation time.
118+
is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. Set
119+
*mtime* to ``0`` to generate a compressed stream that does not depend on
120+
creation time. If *mtime* is omitted or ``None``, the current time is used;
121+
however, if the current time is outside the range 00:00:00 UTC, January 1,
122+
1970 through 06:28:15 UTC, February 7, 2106, or explicitly passed *mtime*
123+
argument is outside the range ``0`` to ``2**32-1``, then the value ``0``
124+
is used instead.
114125

115126
See below for the :attr:`mtime` attribute that is set when decompressing.
116127

0 commit comments

Comments
 (0)