mirror of
https://github.com/python/cpython.git
synced 2025-07-10 04:45:36 +00:00
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:
parent
9f3535c9cd
commit
55edd0c185
56 changed files with 406 additions and 406 deletions
|
@ -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},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue