]> granicus.if.org Git - python/commitdiff
gzip and bz2 are context managers
authorBenjamin Peterson <benjamin@python.org>
Mon, 9 Mar 2009 20:38:56 +0000 (20:38 +0000)
committerBenjamin Peterson <benjamin@python.org>
Mon, 9 Mar 2009 20:38:56 +0000 (20:38 +0000)
Doc/library/bz2.rst
Doc/library/gzip.rst

index 7804c545054ecd2d8d4e81f25144fb069008754e..fa6d7623949700e5a409155c0555de11f5cf863c 100644 (file)
@@ -60,6 +60,11 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
    reading. Instances support iteration in the same way as normal :class:`file`
    instances.
 
+   :class:`BZ2File` supports the :keyword:`with` statement.
+
+   .. versionchanged:: 2.7
+      Support for the :keyword:`with` statement was added.
+
 
    .. method:: close()
 
index 2be8e055db2f2085ad13430488fd481ca2b62f66..c76bae869e6d0633d8cee5d7d387917f2ae4eda2 100644 (file)
@@ -67,6 +67,11 @@ The module defines the following items:
    writing as *fileobj*, and retrieve the resulting memory buffer using the
    :class:`StringIO` object's :meth:`getvalue` method.
 
+   :class:`GzipFile` supports the :keyword:`with` statement.
+
+   .. versionchanged:: 2.7
+      Support for the :keyword:`with` statement was added.
+
 
 .. function:: open(filename[, mode[, compresslevel]])