summaryrefslogtreecommitdiffstats
path: root/Doc/library/zipfile.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/zipfile.rst')
-rw-r--r--Doc/library/zipfile.rst28
1 files changed, 24 insertions, 4 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index bcec134..493e172 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -87,7 +87,22 @@ The module defines the following items:
.. data:: ZIP_DEFLATED
The numeric constant for the usual ZIP compression method. This requires the
- zlib module. No other compression methods are currently supported.
+ zlib module.
+
+
+.. data:: ZIP_BZIP2
+
+ The numeric constant for the BZIP2 compression method. This requires the
+ bz2 module.
+
+ .. versionadded:: 3.3
+
+ .. note::
+
+ The ZIP file format specification has included support for bzip2 compression
+ since 2001. However, some tools (including older Python releases) do not
+ support it, and may either refuse to process the ZIP file altogether, or
+ fail to extract individual files.
.. seealso::
@@ -118,9 +133,11 @@ ZipFile Objects
adding a ZIP archive to another file (such as :file:`python.exe`). If
*mode* is ``a`` and the file does not exist at all, it is created.
*compression* is the ZIP compression method to use when writing the archive,
- and should be :const:`ZIP_STORED` or :const:`ZIP_DEFLATED`; unrecognized
- values will cause :exc:`RuntimeError` to be raised. If :const:`ZIP_DEFLATED`
- is specified but the :mod:`zlib` module is not available, :exc:`RuntimeError`
+ and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`; or
+ :const:`ZIP_DEFLATED`; unrecognized
+ values will cause :exc:`RuntimeError` to be raised. If :const:`ZIP_DEFLATED` or
+ :const:`ZIP_BZIP2` is specified but the corresponded module
+ (:mod:`zlib` or :mod:`bz2`) is not available, :exc:`RuntimeError`
is also raised. The default is :const:`ZIP_STORED`. If *allowZip64* is
``True`` zipfile will create ZIP files that use the ZIP64 extensions when
the zipfile is larger than 2 GB. If it is false (the default) :mod:`zipfile`
@@ -143,6 +160,9 @@ ZipFile Objects
.. versionadded:: 3.2
Added the ability to use :class:`ZipFile` as a context manager.
+ .. versionchanged:: 3.3
+ Added support for :mod:`bzip2` compression.
+
.. method:: ZipFile.close()