summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh.poyarekar@gmail.com>2018-04-29 18:59:33 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2018-04-29 18:59:33 (GMT)
commit55edd0c185ad2d895b5d73e47d67049bc156b654 (patch)
treed609dfc924b59b89816a610ba86cd3e6c34a641c /Python
parent9f3535c9cde8813ce631d6ebe4d790682f594828 (diff)
downloadcpython-55edd0c185ad2d895b5d73e47d67049bc156b654.zip
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.gz
cpython-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.bz2
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 'Python')
-rw-r--r--Python/bltinmodule.c6
-rw-r--r--Python/sysmodule.c28
-rw-r--r--Python/traceback.c2
3 files changed, 18 insertions, 18 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 94f2908..839258b 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -619,7 +619,7 @@ filter_next(filterobject *lz)
}
static PyObject *
-filter_reduce(filterobject *lz)
+filter_reduce(filterobject *lz, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it);
}
@@ -1331,7 +1331,7 @@ exit:
}
static PyObject *
-map_reduce(mapobject *lz)
+map_reduce(mapobject *lz, PyObject *Py_UNUSED(ignored))
{
Py_ssize_t numargs = PyTuple_GET_SIZE(lz->iters);
PyObject *args = PyTuple_New(numargs+1);
@@ -2656,7 +2656,7 @@ zip_next(zipobject *lz)
}
static PyObject *
-zip_reduce(zipobject *lz)
+zip_reduce(zipobject *lz, PyObject *Py_UNUSED(ignored))
{
/* Just recreate the zip with the internal iterator tuple */
return Py_BuildValue("OO", Py_TYPE(lz), lz->ittuple);
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 7cecff6..3fab81a 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -357,7 +357,7 @@ exit status will be one (i.e., failure)."
static PyObject *
-sys_getdefaultencoding(PyObject *self)
+sys_getdefaultencoding(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyUnicode_FromString(PyUnicode_GetDefaultEncoding());
}
@@ -370,7 +370,7 @@ implementation."
);
static PyObject *
-sys_getfilesystemencoding(PyObject *self)
+sys_getfilesystemencoding(PyObject *self, PyObject *Py_UNUSED(ignored))
{
if (Py_FileSystemDefaultEncoding)
return PyUnicode_FromString(Py_FileSystemDefaultEncoding);
@@ -387,7 +387,7 @@ operating system filenames."
);
static PyObject *
-sys_getfilesystemencodeerrors(PyObject *self)
+sys_getfilesystemencodeerrors(PyObject *self, PyObject *Py_UNUSED(ignored))
{
if (Py_FileSystemDefaultEncodeErrors)
return PyUnicode_FromString(Py_FileSystemDefaultEncodeErrors);
@@ -988,7 +988,7 @@ dependent."
);
static PyObject *
-sys_getrecursionlimit(PyObject *self)
+sys_getrecursionlimit(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromLong(Py_GetRecursionLimit());
}
@@ -1274,7 +1274,7 @@ sys_getrefcount(PyObject *self, PyObject *arg)
#ifdef Py_REF_DEBUG
static PyObject *
-sys_gettotalrefcount(PyObject *self)
+sys_gettotalrefcount(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromSsize_t(_Py_GetRefTotal());
}
@@ -1289,7 +1289,7 @@ reference as an argument to getrefcount()."
);
static PyObject *
-sys_getallocatedblocks(PyObject *self)
+sys_getallocatedblocks(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromSsize_t(_Py_GetAllocatedBlocks());
}
@@ -1401,7 +1401,7 @@ a 11-tuple where the entries in the tuple are counts of:\n\
);
static PyObject *
-sys_callstats(PyObject *self)
+sys_callstats(PyObject *self, PyObject *Py_UNUSED(ignored))
{
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"sys.callstats() has been deprecated in Python 3.7 "
@@ -1493,7 +1493,7 @@ static PyMethodDef sys_methods[] = {
/* Might as well keep this in alphabetic order */
{"breakpointhook", (PyCFunction)sys_breakpointhook,
METH_FASTCALL | METH_KEYWORDS, breakpointhook_doc},
- {"callstats", (PyCFunction)sys_callstats, METH_NOARGS,
+ {"callstats", sys_callstats, METH_NOARGS,
callstats_doc},
{"_clear_type_cache", sys_clear_type_cache, METH_NOARGS,
sys_clear_type_cache__doc__},
@@ -1503,13 +1503,13 @@ static PyMethodDef sys_methods[] = {
{"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc},
{"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc},
{"exit", sys_exit, METH_VARARGS, exit_doc},
- {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding,
+ {"getdefaultencoding", sys_getdefaultencoding,
METH_NOARGS, getdefaultencoding_doc},
#ifdef HAVE_DLOPEN
{"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS,
getdlopenflags_doc},
#endif
- {"getallocatedblocks", (PyCFunction)sys_getallocatedblocks, METH_NOARGS,
+ {"getallocatedblocks", sys_getallocatedblocks, METH_NOARGS,
getallocatedblocks_doc},
#ifdef COUNT_ALLOCS
{"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS},
@@ -1517,18 +1517,18 @@ static PyMethodDef sys_methods[] = {
#ifdef DYNAMIC_EXECUTION_PROFILE
{"getdxp", _Py_GetDXProfile, METH_VARARGS},
#endif
- {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding,
+ {"getfilesystemencoding", sys_getfilesystemencoding,
METH_NOARGS, getfilesystemencoding_doc},
- { "getfilesystemencodeerrors", (PyCFunction)sys_getfilesystemencodeerrors,
+ { "getfilesystemencodeerrors", sys_getfilesystemencodeerrors,
METH_NOARGS, getfilesystemencodeerrors_doc },
#ifdef Py_TRACE_REFS
{"getobjects", _Py_GetObjects, METH_VARARGS},
#endif
#ifdef Py_REF_DEBUG
- {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS},
+ {"gettotalrefcount", sys_gettotalrefcount, METH_NOARGS},
#endif
{"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc},
- {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS,
+ {"getrecursionlimit", sys_getrecursionlimit, METH_NOARGS,
getrecursionlimit_doc},
{"getsizeof", (PyCFunction)sys_getsizeof,
METH_VARARGS | METH_KEYWORDS, getsizeof_doc},
diff --git a/Python/traceback.c b/Python/traceback.c
index b00864b..21fb034 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -87,7 +87,7 @@ tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame,
}
static PyObject *
-tb_dir(PyTracebackObject *self)
+tb_dir(PyTracebackObject *self, PyObject *Py_UNUSED(ignored))
{
return Py_BuildValue("[ssss]", "tb_frame", "tb_next",
"tb_lasti", "tb_lineno");