summaryrefslogtreecommitdiff
path: root/Doc/library/telnetlib.rst
diff options
context:
space:
mode:
authorMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
committerMariatta Wijaya <mariatta.wijaya@gmail.com>2017-02-06 20:16:58 -0800
commitda79bcf8ac7ae72218ab023e1ed54390bc1a3a27 (patch)
tree74845e2dbd9521d9748b9c32f1922f4123083bf3 /Doc/library/telnetlib.rst
parente3c7e835bdfc97750eb9b7fc0ad2493108c2d438 (diff)
parent1fe806ac56f8b83694d24ab604eb695d00bc8497 (diff)
downloadcpython-da79bcf8ac7ae72218ab023e1ed54390bc1a3a27.tar.gz
Issue #29371: merge with 3.5
Diffstat (limited to 'Doc/library/telnetlib.rst')
-rw-r--r--Doc/library/telnetlib.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/telnetlib.rst b/Doc/library/telnetlib.rst
index b950e41dc1..f9c5153e3f 100644
--- a/Doc/library/telnetlib.rst
+++ b/Doc/library/telnetlib.rst
@@ -43,6 +43,17 @@ Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation Begin).
:exc:`EOFError` when the end of the connection is read, because they can return
an empty string for other reasons. See the individual descriptions below.
+ A :class:`Telnet` object is a context manager and can be used in a
+ :keyword:`with` statement. When the :keyword:`with` block ends, the
+ :meth:`close` method is called::
+
+ >>> from telnetlib import Telnet
+ >>> with Telnet('localhost', 23) as tn:
+ ... tn.interact()
+ ...
+
+ .. versionchanged:: 3.6 Context manager support added
+
.. seealso::