gh-155621: Fix unrepresentable defaults in socket.sendmsg() signature (#155623)

This commit is contained in:
stevens authored and GitHub committed 2026-08-14 15:33:42 +00:00
1 parent a7b2e1f4e0
commit e5556cdf71
3 files changed
+6 -7

No files matched your search

+1 -1
View File
@@ -6340,7 +6340,7 @@ class TestSignatureDefinitions(unittest.TestCase):
# depends on the number of the arguments.
methods_no_signature = {'ioctl', 'sendto', 'setsockopt'}
# These have parameters with unrepresentable default values.
methods_unsupported_signature = {'listen', 'sendmsg', 'sendmsg_afalg'}
methods_unsupported_signature = {'listen', 'sendmsg_afalg'}
defined = vars(socket.SocketType).keys()
self._test_module_has_signatures(socket,
no_signature, unsupported_signature,
+2 -3
View File
@@ -1018,8 +1018,7 @@ exit:
#if defined(CMSG_LEN)
PyDoc_STRVAR(_socket_socket_sendmsg__doc__,
"sendmsg($self, buffers, ancdata=<unrepresentable>, flags=0,\n"
" address=<unrepresentable>, /)\n"
"sendmsg($self, buffers, ancdata=(), flags=0, address=None, /)\n"
"--\n"
"\n"
"Send normal and ancillary data to the socket.\n"
@@ -2479,4 +2478,4 @@ exit:
#ifndef _SOCKET_CMSG_SPACE_METHODDEF
#define _SOCKET_CMSG_SPACE_METHODDEF
#endif /* !defined(_SOCKET_CMSG_SPACE_METHODDEF) */
/*[clinic end generated code: output=133662a8c304b1b7 input=a9049054013a1b77]*/
/*[clinic end generated code: output=acc30d6fdeb54e90 input=a9049054013a1b77]*/
+3 -3
View File
@@ -4990,9 +4990,9 @@ sock_sendmsg_impl(PySocketSockObject *s, void *data)
_socket.socket.sendmsg
self as s: self(type="PySocketSockObject *")
buffers as data_arg: object
ancdata as cmsg_arg: object = NULL
ancdata as cmsg_arg: object(c_default="NULL") = ()
flags: int = 0
address as addr_arg: object = NULL
address as addr_arg: object(c_default="NULL") = None
/
Send normal and ancillary data to the socket.
@@ -5016,7 +5016,7 @@ static PyObject *
_socket_socket_sendmsg_impl(PySocketSockObject *s, PyObject *data_arg,
PyObject *cmsg_arg, int flags,
PyObject *addr_arg)
/*[clinic end generated code: output=3b4cb1110644ce39 input=8ae408971a3aa329]*/
/*[clinic end generated code: output=3b4cb1110644ce39 input=5fdf9b49bed3848b]*/
{
Py_ssize_t i, ndatabufs = 0, ncmsgs, ncmsgbufs = 0;