aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh.poyarekar@gmail.com>2018-04-30 00:29:33 +0530
committerSerhiy Storchaka <storchaka@gmail.com>2018-04-29 21:59:33 +0300
commit55edd0c185ad2d895b5d73e47d67049bc156b654 (patch)
treed609dfc924b59b89816a610ba86cd3e6c34a641c /Modules/socketmodule.c
parentbpo-32362: Fix references to non-existent multiprocessing.Connection() (GH-6223) (diff)
downloadcpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.gz
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.bz2
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.zip
bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. (GH-6030)
METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index c7a07512026..30001754fe5 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2504,7 +2504,7 @@ sock_accept_impl(PySocketSockObject *s, void *data)
/* s._accept() -> (fd, address) */
static PyObject *
-sock_accept(PySocketSockObject *s)
+sock_accept(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
sock_addr_t addrbuf;
SOCKET_T newfd;
@@ -2605,7 +2605,7 @@ setblocking(False) is equivalent to settimeout(0.0).");
False if it is in non-blocking mode.
*/
static PyObject *
-sock_getblocking(PySocketSockObject *s)
+sock_getblocking(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
if (s->sock_timeout) {
Py_RETURN_TRUE;
@@ -2717,7 +2717,7 @@ Setting a timeout of zero is the same as setblocking(0).");
/* s.gettimeout() method.
Returns the timeout associated with a socket. */
static PyObject *
-sock_gettimeout(PySocketSockObject *s)
+sock_gettimeout(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
if (s->sock_timeout < 0) {
Py_RETURN_NONE;
@@ -2930,7 +2930,7 @@ sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])");
will surely fail. */
static PyObject *
-sock_close(PySocketSockObject *s)
+sock_close(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
SOCKET_T fd;
int res;
@@ -2961,7 +2961,7 @@ PyDoc_STRVAR(sock_close_doc,
Close the socket. It cannot be used after this call.");
static PyObject *
-sock_detach(PySocketSockObject *s)
+sock_detach(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
SOCKET_T fd = s->sock_fd;
s->sock_fd = INVALID_SOCKET;
@@ -3117,7 +3117,7 @@ instead of raising an exception when an error occurs.");
/* s.fileno() method */
static PyObject *
-sock_fileno(PySocketSockObject *s)
+sock_fileno(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromSocket_t(s->sock_fd);
}
@@ -3131,7 +3131,7 @@ Return the integer file descriptor of the socket.");
/* s.getsockname() method */
static PyObject *
-sock_getsockname(PySocketSockObject *s)
+sock_getsockname(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
sock_addr_t addrbuf;
int res;
@@ -3160,7 +3160,7 @@ info is a pair (hostaddr, port).");
/* s.getpeername() method */
static PyObject *
-sock_getpeername(PySocketSockObject *s)
+sock_getpeername(PySocketSockObject *s, PyObject *Py_UNUSED(ignored))
{
sock_addr_t addrbuf;
int res;
@@ -6390,7 +6390,7 @@ Get host and port for a sockaddr.");
/* Python API to getting and setting the default timeout value. */
static PyObject *
-socket_getdefaulttimeout(PyObject *self)
+socket_getdefaulttimeout(PyObject *self, PyObject *Py_UNUSED(ignored))
{
if (defaulttimeout < 0) {
Py_RETURN_NONE;
@@ -6639,7 +6639,7 @@ static PyMethodDef socket_methods[] = {
METH_VARARGS | METH_KEYWORDS, getaddrinfo_doc},
{"getnameinfo", socket_getnameinfo,
METH_VARARGS, getnameinfo_doc},
- {"getdefaulttimeout", (PyCFunction)socket_getdefaulttimeout,
+ {"getdefaulttimeout", socket_getdefaulttimeout,
METH_NOARGS, getdefaulttimeout_doc},
{"setdefaulttimeout", socket_setdefaulttimeout,
METH_O, setdefaulttimeout_doc},