diff -r 82343bbf8868 Doc/library/socket.rst --- a/Doc/library/socket.rst Fri Feb 22 08:28:14 2013 +0200 +++ b/Doc/library/socket.rst Sat Feb 23 19:35:03 2013 +0100 @@ -389,7 +389,7 @@ ``'udp'``, otherwise any protocol will match. -.. function:: socket([family[, type[, proto]]]) +.. function:: socket([family[, type[, proto[, fileno]]]]) Create a new socket using the given address family, socket type and protocol number. The address family should be :const:`AF_INET` (the default), @@ -398,6 +398,13 @@ other ``SOCK_`` constants. The protocol number is usually zero and may be omitted in that case. + .. note:: + If a file descriptor *fileno* is specified, the other arguments + are ignored and and the socket with this file descriptor is returned. Unlike + :meth:`fromfd`, this does not cause a duplication of the file descriptor + and therefore supports the special case of closing detached socket handles + on Windows using ``socket.socket(fileno=handle).close()``. + .. function:: socketpair([family[, type[, proto]]])