From a537b27bd45ebe8d218a0e902323b1b5618a3e7f Mon Sep 17 00:00:00 2001 From: "benjamin.peterson" Date: Mon, 9 Mar 2009 20:38:56 +0000 Subject: [PATCH] gzip and bz2 are context managers git-svn-id: http://svn.python.org/projects/python/trunk@70281 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Doc/library/bz2.rst | 5 +++++ Doc/library/gzip.rst | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst index 7804c54505..fa6d762394 100644 --- a/Doc/library/bz2.rst +++ b/Doc/library/bz2.rst @@ -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() diff --git a/Doc/library/gzip.rst b/Doc/library/gzip.rst index 2be8e055db..c76bae869e 100644 --- a/Doc/library/gzip.rst +++ b/Doc/library/gzip.rst @@ -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]]) -- 2.11.4.GIT