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.
This commit is contained in:
Siddhesh Poyarekar 2018-04-30 00:29:33 +05:30 committed by Serhiy Storchaka
parent 9f3535c9cd
commit 55edd0c185
56 changed files with 406 additions and 406 deletions

View file

@ -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},