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

Skip to content

Commit 24a6109

Browse files
committed
Issue #16802: Document fileno parameter of socket.socket()
Patch by Henrik Heimbuerger and Bar Harel.
1 parent 9955a37 commit 24a6109

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
@@ -369,7 +369,11 @@ The following functions all create :ref:`socket objects <socket-objects>`.
369369
:const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_``
370370
constants. The protocol number is usually zero and may be omitted or in the
371371
case where the address family is :const:`AF_CAN` the protocol should be one
372-
of :const:`CAN_RAW` or :const:`CAN_BCM`.
372+
of :const:`CAN_RAW` or :const:`CAN_BCM`. If *fileno* is specified, the other
373+
arguments are ignored, causing the socket with the specified file descriptor
374+
to return. Unlike :func:`socket.fromfd`, *fileno* will return the same
375+
socket and not a duplicate. This may help close a detached socket using
376+
:meth:`socket.close()`.
373377

374378
The newly created socket is :ref:`non-inheritable <fd_inheritance>`.
375379

0 commit comments

Comments
 (0)