Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Lib/test/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import errno
import fractions
import gc
import inspect
import io
import itertools
import math
Expand Down Expand Up @@ -945,6 +946,14 @@ def requireSocket(*args):

class GeneralModuleTests(unittest.TestCase):

@unittest.skipUnless(hasattr(socket.socket, "sendmsg"),
"sendmsg not supported")
def test_sendmsg_signature(self):
self.assertEqual(
str(inspect.signature(socket.socket.sendmsg)),
"(self, buffers, ancdata=(), flags=0, address=None, /)",
)

Comment on lines +949 to +956

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing the function's signature seems pointless and unusual.

@unittest.skipUnless(_socket is not None, 'need _socket module')
def test_socket_type(self):
self.assertTrue(gc.is_tracked(_socket.socket))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix the signature of :meth:`socket.socket.sendmsg` to expose the *ancdata*
and *address* defaults as ``()`` and ``None`` instead of
``<unrepresentable>``.
5 changes: 2 additions & 3 deletions Modules/clinic/socketmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -4929,9 +4929,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.
Expand All @@ -4955,7 +4955,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;
Expand Down
Loading