summaryrefslogtreecommitdiffstats
path: root/Doc/library/mailbox.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-10-30 14:33:28 (GMT)
committerGeorg Brandl <georg@python.org>2010-10-30 14:33:28 (GMT)
commit6ce29fa7a89cd266ca9dd3e21ed40f9100eb70f6 (patch)
tree0a848c45edb3c61a90c828794897a7b455bc53c4 /Doc/library/mailbox.rst
parent849e12bfe943be4f18f5d0e21087b1cb08d472dd (diff)
downloadcpython-6ce29fa7a89cd266ca9dd3e21ed40f9100eb70f6.zip
cpython-6ce29fa7a89cd266ca9dd3e21ed40f9100eb70f6.tar.gz
cpython-6ce29fa7a89cd266ca9dd3e21ed40f9100eb70f6.tar.bz2
Fix test_mailbox by supporting context manager protocol for get_file() returns.
Diffstat (limited to 'Doc/library/mailbox.rst')
-rw-r--r--Doc/library/mailbox.rst10
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst
index b041d94..da01791 100644
--- a/Doc/library/mailbox.rst
+++ b/Doc/library/mailbox.rst
@@ -180,15 +180,19 @@ Maildir, mbox, MH, Babyl, and MMDF.
.. method:: get_file(key)
Return a file-like representation of the message corresponding to *key*,
- or raise a :exc:`KeyError` exception if no such message exists. The
- file-like object behaves as if open in binary mode. This file should be
+ or raise a :exc:`KeyError` exception if no such message exists. The
+ file-like object behaves as if open in binary mode. This file should be
closed once it is no longer needed.
+ .. versionadded:: 3.2
+ The file-like object supports the context manager protocol, so that
+ you can use a :keyword:`with` statement to automatically close it.
+
.. note::
Unlike other representations of messages, file-like representations are
not necessarily independent of the :class:`Mailbox` instance that
- created them or of the underlying mailbox. More specific documentation
+ created them or of the underlying mailbox. More specific documentation
is provided by each subclass.