From 0c875b3ef125c2a5b8341f631028c224bf8c0836 Mon Sep 17 00:00:00 2001 From: gousaiyang Date: Thu, 8 Oct 2020 17:21:16 -0700 Subject: [PATCH 1/3] bpo-28724: Move socket.send_fds and socket.recv_fds documentation to the "Other functions" section --- Doc/library/socket.rst | 49 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index 30b3c5e24eefc4..f96776b269952e 100755 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1143,6 +1143,32 @@ The :mod:`socket` module also offers various network-related services: "Interface name" is a name as documented in :func:`if_nameindex`. +.. function:: socket.send_fds(sock, buffers, fds[, flags[, address]]) + + Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket *sock*. + The *fds* parameter is a sequence of file descriptors. + Consult :meth:`sendmsg` for the documentation of these parameters. + + .. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism. + + .. versionadded:: 3.9 + + +.. function:: socket.recv_fds(sock, bufsize, maxfds[, flags]) + + Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket *sock*. + Return ``(msg, list(fds), flags, addr)``. + Consult :meth:`recvmsg` for the documentation of these parameters. + + .. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism. + + .. versionadded:: 3.9 + + .. note:: + + Any truncated integers at the end of the list of file descriptors. + + .. _socket-objects: Socket Objects @@ -1637,29 +1663,6 @@ to sockets. .. versionadded:: 3.6 -.. method:: socket.send_fds(sock, buffers, fds[, flags[, address]]) - - Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket. - The *fds* parameter is a sequence of file descriptors. - Consult :meth:`sendmsg` for the documentation of these parameters. - - .. availability:: Unix supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` mechanism. - - .. versionadded:: 3.9 - -.. method:: socket.recv_fds(sock, bufsize, maxfds[, flags]) - - Receive up to *maxfds* file descriptors. Return ``(msg, list(fds), flags, addr)``. Consult - :meth:`recvmsg` for the documentation of these parameters. - - .. availability:: Unix supporting :meth:`~socket.recvmsg` and :const:`SCM_RIGHTS` mechanism. - - .. versionadded:: 3.9 - - .. note:: - - Any truncated integers at the end of the list of file descriptors. - .. method:: socket.sendfile(file, offset=0, count=None) Send a file until EOF is reached by using high-performance From 0b1c480b220361423bfcf49accd4547fb0b266bb Mon Sep 17 00:00:00 2001 From: gousaiyang Date: Wed, 21 Apr 2021 17:28:58 -0700 Subject: [PATCH 2/3] Simplify --- Doc/library/socket.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index f96776b269952e..8a1fc96e0362e2 100755 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -1143,7 +1143,7 @@ The :mod:`socket` module also offers various network-related services: "Interface name" is a name as documented in :func:`if_nameindex`. -.. function:: socket.send_fds(sock, buffers, fds[, flags[, address]]) +.. function:: send_fds(sock, buffers, fds[, flags[, address]]) Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket *sock*. The *fds* parameter is a sequence of file descriptors. @@ -1154,7 +1154,7 @@ The :mod:`socket` module also offers various network-related services: .. versionadded:: 3.9 -.. function:: socket.recv_fds(sock, bufsize, maxfds[, flags]) +.. function:: recv_fds(sock, bufsize, maxfds[, flags]) Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket *sock*. Return ``(msg, list(fds), flags, addr)``. From dd6212792ef33767184e56f83d9c83a00fa84c37 Mon Sep 17 00:00:00 2001 From: gousaiyang Date: Wed, 21 Apr 2021 18:44:01 -0700 Subject: [PATCH 3/3] Fix whatsnew typo --- Doc/whatsnew/3.9.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 174d9e24be319b..602ed065858ecd 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -658,7 +658,7 @@ The socket module now supports the :data:`~socket.CAN_J1939` protocol on platforms that support it. (Contributed by Karl Ding in :issue:`40291`.) The socket module now has the :func:`socket.send_fds` and -:func:`socket.recv.fds` methods. (Contributed by Joannah Nanjekye, Shinya +:func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and Victor Stinner in :issue:`28724`.)