Fix issue 9794: adds context manager protocol to socket.socket so that socket.create_connection() can be used with the 'with' statement.
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 581756f..a7656c1 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -213,6 +213,9 @@
.. versionchanged:: 3.2
*source_address* was added.
+ .. versionchanged:: 3.2
+ support for the :keyword:`with` statement was added.
+
.. function:: getaddrinfo(host, port, family=0, type=0, proto=0, flags=0)
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst
index 4969623..7d8970b 100644
--- a/Doc/whatsnew/3.2.rst
+++ b/Doc/whatsnew/3.2.rst
@@ -389,6 +389,12 @@
(Contributed by Giampaolo Rodolà; :issue:`8807`.)
+* :func:`socket.create_connection` now supports the context manager protocol
+ to unconditionally consume :exc:`socket.error` exceptions and to close the
+ socket when done.
+
+ (Contributed by Giampaolo Rodolà; :issue:`9794`.)
+
Multi-threading
===============