diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-18 22:11:13 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-18 22:11:13 (GMT) |
commit | ee1be99e050db5ec2db534a2a28beb12ccf159de (patch) | |
tree | 6650c81d603e88bc0f2ae6c70b8688a204374778 /Doc | |
parent | 8a9e99cffcb579c208ccf92454be931e8a26dc39 (diff) | |
download | cpython-ee1be99e050db5ec2db534a2a28beb12ccf159de.zip cpython-ee1be99e050db5ec2db534a2a28beb12ccf159de.tar.gz cpython-ee1be99e050db5ec2db534a2a28beb12ccf159de.tar.bz2 |
Issue #19222: Add support for the 'x' mode to the gzip module.
Original patch by Tim Heaney.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/gzip.rst | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index ec16f6a..de5063a 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -35,8 +35,8 @@ The module defines the following items: :class:`bytes` object), or an existing file object to read from or write to. The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, - ``'w'``, or ``'wb'`` for binary mode, or ``'rt'``, ``'at'``, or ``'wt'`` for - text mode. The default is ``'rb'``. + ``'w'``, ``'wb'``, ``'x'`` or ``'xb'`` for binary mode, or ``'rt'``, + ``'at'``, ``'wt'``, or ``'xt'`` for text mode. The default is ``'rb'``. The *compresslevel* argument is an integer from 0 to 9, as for the :class:`GzipFile` constructor. @@ -53,6 +53,9 @@ The module defines the following items: Added support for *filename* being a file object, support for text mode, and the *encoding*, *errors* and *newline* arguments. + .. versionchanged:: 3.4 + Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes. + .. class:: GzipFile(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None) @@ -73,8 +76,9 @@ The module defines the following items: original filename is not included in the header. The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, ``'w'``, - or ``'wb'``, depending on whether the file will be read or written. The default - is the mode of *fileobj* if discernible; otherwise, the default is ``'rb'``. + ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will be read or + written. The default is the mode of *fileobj* if discernible; otherwise, the + default is ``'rb'``. Note that the file is always opened in binary mode. To open a compressed file in text mode, use :func:`.open` (or wrap your :class:`GzipFile` with an @@ -125,6 +129,9 @@ The module defines the following items: .. versionchanged:: 3.3 The :meth:`io.BufferedIOBase.read1` method is now implemented. + .. versionchanged:: 3.4 + Added support for the ``'x'`` and ``'xb'`` modes. + .. function:: compress(data, compresslevel=9) |