summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorGiampaolo Rodolà <g.rodola@gmail.com>2011-03-03 18:34:06 (GMT)
committerGiampaolo Rodolà <g.rodola@gmail.com>2011-03-03 18:34:06 (GMT)
commit424298a155b5cc652ce1e539a1fedb658fba9cd1 (patch)
tree429c5ddf30e4c2cfcc9609fa8e5a2209de686127 /Doc/whatsnew
parent4db28d3343da7e48946a62036058fc6f0ee7cd71 (diff)
downloadcpython-424298a155b5cc652ce1e539a1fedb658fba9cd1.zip
cpython-424298a155b5cc652ce1e539a1fedb658fba9cd1.tar.gz
cpython-424298a155b5cc652ce1e539a1fedb658fba9cd1.tar.bz2
Issue 9795: adds context manager protocol to nntplib.NNTP class so that it can used with the 'with' statement.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.3.rst16
1 files changed, 16 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index c0cb7cf..d86826c 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -88,6 +88,22 @@ os
(Patch submitted by Giampaolo Rodolà in :issue:`10784`.)
+nntplib
+-------
+
+The :class:`nntplib.NNTP` class now supports the context manager protocol to
+unconditionally consume :exc:`socket.error` exceptions and to close the NNTP
+connection when done::
+
+ >>> from nntplib import NNTP
+ >>> with nntplib.NNTP('news.gmane.org') as n:
+ ... n.group('gmane.comp.python.committers')
+ ...
+ ('211 1454 1 1454 gmane.comp.python.committers', '1454', '1', '1454', 'gmane.comp.python.committers')
+ >>>
+
+(Contributed by Giampaolo Rodolà in :issue:`9795`)
+
Optimizations
=============