https://github.com/python/cpython/commit/37232aa94c83e7ed0d637380ae4625f2f2fd6e34
commit: 37232aa94c83e7ed0d637380ae4625f2f2fd6e34
branch: 3.15
author: An Long <[email protected]>
committer: encukou <[email protected]>
date: 2026-10-12T14:07:28+02:00
summary:

[3.15] gh-155621: Fix unrepresentable defaults in socket.sendmsg() signature 
(GH-155623) (GH-155802)

(cherry picked from commit e5556cdf71f7f5561fcaca21f6e680ebdd44cffb)

Co-authored-by: stevens <[email protected]>

files:
M Modules/clinic/socketmodule.c.h
M Modules/socketmodule.c

diff --git a/Modules/clinic/socketmodule.c.h b/Modules/clinic/socketmodule.c.h
index b565e7516d50f3..aeed9e96435b93 100644
--- a/Modules/clinic/socketmodule.c.h
+++ b/Modules/clinic/socketmodule.c.h
@@ -130,8 +130,7 @@ _socket_socket_sendall(PyObject *s, PyObject *const *args, 
Py_ssize_t nargs)
 #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"
@@ -543,4 +542,4 @@ _socket_if_indextoname(PyObject *module, PyObject *arg)
 #ifndef _SOCKET_IF_INDEXTONAME_METHODDEF
     #define _SOCKET_IF_INDEXTONAME_METHODDEF
 #endif /* !defined(_SOCKET_IF_INDEXTONAME_METHODDEF) */
-/*[clinic end generated code: output=0b1fa78ac6589353 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=116cf1cf631becf2 input=a9049054013a1b77]*/
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 2b1a6246c185a9..68762414a4a0d3 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -4925,9 +4925,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.
@@ -4951,7 +4951,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;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to