diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> | 2018-04-30 00:29:33 +0530 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-29 21:59:33 +0300 |
commit | 55edd0c185ad2d895b5d73e47d67049bc156b654 (patch) | |
tree | d609dfc924b59b89816a610ba86cd3e6c34a641c /Modules/_xxsubinterpretersmodule.c | |
parent | 9f3535c9cde8813ce631d6ebe4d790682f594828 (diff) | |
download | cpython-git-55edd0c185ad2d895b5d73e47d67049bc156b654.tar.gz |
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/_xxsubinterpretersmodule.c')
-rw-r--r-- | Modules/_xxsubinterpretersmodule.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 49d3b48e38..634823a7a2 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -2171,7 +2171,7 @@ So does an unrecognized ID."); static PyObject * -interp_list_all(PyObject *self) +interp_list_all(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyObject *ids, *id; PyInterpreterState *interp; @@ -2209,7 +2209,7 @@ Return a list containing the ID of every existing interpreter."); static PyObject * -interp_get_current(PyObject *self) +interp_get_current(PyObject *self, PyObject *Py_UNUSED(ignored)) { PyInterpreterState *interp =_get_current(); if (interp == NULL) { @@ -2225,7 +2225,7 @@ Return the ID of current interpreter."); static PyObject * -interp_get_main(PyObject *self) +interp_get_main(PyObject *self, PyObject *Py_UNUSED(ignored)) { // Currently, 0 is always the main interpreter. return PyLong_FromLongLong(0); @@ -2341,7 +2341,7 @@ PyDoc_STRVAR(is_running_doc, Return whether or not the identified interpreter is running."); static PyObject * -channel_create(PyObject *self) +channel_create(PyObject *self, PyObject *Py_UNUSED(ignored)) { int64_t cid = _channel_create(&_globals.channels); if (cid < 0) { @@ -2389,7 +2389,7 @@ Close and finalize the channel. Afterward attempts to use the channel\n\ will behave as though it never existed."); static PyObject * -channel_list_all(PyObject *self) +channel_list_all(PyObject *self, PyObject *Py_UNUSED(ignored)) { int64_t count = 0; int64_t *cids = _channels_list_all(&_globals.channels, &count); @@ -2546,11 +2546,11 @@ static PyMethodDef module_functions[] = { METH_VARARGS, create_doc}, {"destroy", (PyCFunction)interp_destroy, METH_VARARGS, destroy_doc}, - {"list_all", (PyCFunction)interp_list_all, + {"list_all", interp_list_all, METH_NOARGS, list_all_doc}, - {"get_current", (PyCFunction)interp_get_current, + {"get_current", interp_get_current, METH_NOARGS, get_current_doc}, - {"get_main", (PyCFunction)interp_get_main, + {"get_main", interp_get_main, METH_NOARGS, get_main_doc}, {"is_running", (PyCFunction)interp_is_running, METH_VARARGS, is_running_doc}, @@ -2560,11 +2560,11 @@ static PyMethodDef module_functions[] = { {"is_shareable", (PyCFunction)object_is_shareable, METH_VARARGS, is_shareable_doc}, - {"channel_create", (PyCFunction)channel_create, + {"channel_create", channel_create, METH_NOARGS, channel_create_doc}, {"channel_destroy", (PyCFunction)channel_destroy, METH_VARARGS, channel_destroy_doc}, - {"channel_list_all", (PyCFunction)channel_list_all, + {"channel_list_all", channel_list_all, METH_NOARGS, channel_list_all_doc}, {"channel_send", (PyCFunction)channel_send, METH_VARARGS, channel_send_doc}, |