# HG changeset patch # Parent 328383905eafcb7c4a39f065a922aaddacb66658 Issue #24911: Clarify that all socket objects are context managers diff -r 328383905eaf Doc/library/socket.rst --- a/Doc/library/socket.rst Mon Aug 31 03:15:52 2015 +0000 +++ b/Doc/library/socket.rst Mon Aug 31 04:13:25 2015 +0000 @@ -386,9 +386,6 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 - support for the :keyword:`with` statement was added. - .. function:: fromfd(fd, family, type, proto=0) @@ -770,6 +767,10 @@ :meth:`~socket.makefile`, these correspond to Unix system calls applicable to sockets. +.. versionchanged:: 3.2 + Support for the :keyword:`with` statement was added. Exiting the + context manager is equivalent to calling :meth:`~socket.close`. + .. method:: socket.accept() diff -r 328383905eaf Misc/NEWS --- a/Misc/NEWS Mon Aug 31 03:15:52 2015 +0000 +++ b/Misc/NEWS Mon Aug 31 04:13:25 2015 +0000 @@ -456,6 +456,9 @@ Documentation ------------- +- Issue #24911: Clarify that all socket objects support the + context manager protocol, not just those returned by create_connection(). + - Issue #24952: Clarify the default size argument of stack_size() in the "threading" and "_thread" modules. Patch from Mattip.