diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-18 22:11:06 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2013-10-18 22:11:06 (GMT) |
commit | 8a9e99cffcb579c208ccf92454be931e8a26dc39 (patch) | |
tree | 94d3e3b07c08dd9db8c6765c0693c6dc0e23fe09 /Doc | |
parent | 42ca98217ca544220fdf4d33875c811f342edc56 (diff) | |
download | cpython-8a9e99cffcb579c208ccf92454be931e8a26dc39.zip cpython-8a9e99cffcb579c208ccf92454be931e8a26dc39.tar.gz cpython-8a9e99cffcb579c208ccf92454be931e8a26dc39.tar.bz2 |
Issue #19223: Add support for the 'x' mode to the bz2 module.
Patch by Tim Heaney and Vajrasky Kok.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/bz2.rst | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst index d06a39a..44e1331 100644 --- a/Doc/library/bz2.rst +++ b/Doc/library/bz2.rst @@ -37,8 +37,8 @@ All of the classes in this module may safely be accessed from multiple threads. file object to read from or write to. The *mode* argument can be any of ``'r'``, ``'rb'``, ``'w'``, ``'wb'``, - ``'a'``, or ``'ab'`` for binary mode, or ``'rt'``, ``'wt'``, or ``'at'`` for - text mode. The default is ``'rb'``. + ``'x'``, ``'xb'``, ``'a'`` or ``'ab'`` for binary mode, or ``'rt'``, + ``'wt'``, ``'xt'``, or ``'at'`` for text mode. The default is ``'rb'``. The *compresslevel* argument is an integer from 1 to 9, as for the :class:`BZ2File` constructor. @@ -54,6 +54,9 @@ All of the classes in this module may safely be accessed from multiple threads. .. versionadded:: 3.3 + .. versionchanged:: 3.4 + The ``'x'`` (exclusive creation) mode was added. + .. class:: BZ2File(filename, mode='r', buffering=None, compresslevel=9) @@ -64,8 +67,9 @@ All of the classes in this module may safely be accessed from multiple threads. be used to read or write the compressed data. The *mode* argument can be either ``'r'`` for reading (default), ``'w'`` for - overwriting, or ``'a'`` for appending. These can equivalently be given as - ``'rb'``, ``'wb'``, and ``'ab'`` respectively. + overwriting, ``'x'`` for exclusive creation, or ``'a'`` for appending. These + can equivalently be given as ``'rb'``, ``'wb'``, ``'xb'`` and ``'ab'`` + respectively. If *filename* is a file object (rather than an actual file name), a mode of ``'w'`` does not truncate the file, and is instead equivalent to ``'a'``. @@ -108,6 +112,9 @@ All of the classes in this module may safely be accessed from multiple threads. The ``'a'`` (append) mode was added, along with support for reading multi-stream files. + .. versionchanged:: 3.4 + The ``'x'`` (exclusive creation) mode was added. + Incremental (de)compression --------------------------- |