diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-01 13:10:12 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-01 13:10:12 +0200 |
commit | 9a3a7d1676e3e162e2213ddf62c925e8d9b724af (patch) | |
tree | c934e04d1f64ced2268ce81c3618e3f416a3ce74 /Doc/library/imaplib.rst | |
parent | cff8685224e9c1d0024aecfb87a2c120ca3a5542 (diff) | |
parent | ab27b2a1ce268e24b44ea0e63ccff6b96e4f710e (diff) | |
download | cpython-9a3a7d1676e3e162e2213ddf62c925e8d9b724af.tar.gz |
Issue #21032. Fixed socket leak if HTTPConnection.getresponse() fails.
Original patch by Martin Panter.
Diffstat (limited to 'Doc/library/imaplib.rst')
-rw-r--r-- | Doc/library/imaplib.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst index fa736fe3af..f263bab9f0 100644 --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -37,6 +37,19 @@ base class: initialized. If *host* is not specified, ``''`` (the local host) is used. If *port* is omitted, the standard IMAP4 port (143) is used. + The :class:`IMAP4` class supports the :keyword:`with` statement. When used + like this, the IMAP4 ``LOGOUT`` command is issued automatically when the + :keyword:`with` statement exits. E.g.:: + + >>> from imaplib import IMAP4 + >>> with IMAP4("domain.org") as M: + ... M.noop() + ... + ('OK', [b'Nothing Accomplished. d25if65hy903weo.87']) + + .. versionchanged:: 3.5 + Support for the :keyword:`with` statement was added. + Three exceptions are defined as attributes of the :class:`IMAP4` class: |