Issue 9795: adds context manager protocol to nntplib.NNTP class so that it can used with the 'with' statement.
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 @@
(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
=============