Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ce88d82

Browse files
committed
Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
2 parents ec1aa5c + 24a6109 commit ce88d82

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Doc/library/socket.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,11 @@ The following functions all create :ref:`socket objects <socket-objects>`.
384384
:const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_``
385385
constants. The protocol number is usually zero and may be omitted or in the
386386
case where the address family is :const:`AF_CAN` the protocol should be one
387-
of :const:`CAN_RAW` or :const:`CAN_BCM`.
387+
of :const:`CAN_RAW` or :const:`CAN_BCM`. If *fileno* is specified, the other
388+
arguments are ignored, causing the socket with the specified file descriptor
389+
to return. Unlike :func:`socket.fromfd`, *fileno* will return the same
390+
socket and not a duplicate. This may help close a detached socket using
391+
:meth:`socket.close()`.
388392

389393
The newly created socket is :ref:`non-inheritable <fd_inheritance>`.
390394

0 commit comments

Comments
 (0)