[Python-checkins] cpython (merge 3.5 -> default): Issue #16802: Document fileno parameter of socket.socket()

berker.peksag python-checkins at python.org
Wed Oct 7 23:35:05 EDT 2015


https://hg.python.org/cpython/rev/9115c63cf3d2
changeset:   98594:9115c63cf3d2
parent:      98591:3291e6132a67
parent:      98593:1d14675c6050
user:        Berker Peksag <berker.peksag at gmail.com>
date:        Thu Oct 08 06:34:57 2015 +0300
summary:
  Issue #16802: Document fileno parameter of socket.socket()

Patch by Henrik Heimbuerger and Bar Harel.

files:
  Doc/library/socket.rst |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -384,7 +384,11 @@
    :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_``
    constants. The protocol number is usually zero and may be omitted or in the
    case where the address family is :const:`AF_CAN` the protocol should be one
-   of :const:`CAN_RAW` or :const:`CAN_BCM`.
+   of :const:`CAN_RAW` or :const:`CAN_BCM`.  If *fileno* is specified, the other
+   arguments are ignored, causing the socket with the specified file descriptor
+   to return.  Unlike :func:`socket.fromfd`, *fileno* will return the same
+   socket and not a duplicate. This may help close a detached socket using
+   :meth:`socket.close()`.
 
    The newly created socket is :ref:`non-inheritable <fd_inheritance>`.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list