diff options
author | Siddhesh Poyarekar <siddhesh.poyarekar@gmail.com> | 2018-04-29 18:59:33 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-04-29 18:59:33 (GMT) |
commit | 55edd0c185ad2d895b5d73e47d67049bc156b654 (patch) | |
tree | d609dfc924b59b89816a610ba86cd3e6c34a641c /Objects/odictobject.c | |
parent | 9f3535c9cde8813ce631d6ebe4d790682f594828 (diff) | |
download | cpython-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 'Objects/odictobject.c')
-rw-r--r-- | Objects/odictobject.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Objects/odictobject.c b/Objects/odictobject.c index ac97f52..2040715 100644 --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -884,7 +884,7 @@ OrderedDict_fromkeys_impl(PyTypeObject *type, PyObject *seq, PyObject *value) PyDoc_STRVAR(odict_sizeof__doc__, ""); static PyObject * -odict_sizeof(PyODictObject *od) +odict_sizeof(PyODictObject *od, PyObject *Py_UNUSED(ignored)) { Py_ssize_t res = _PyDict_SizeOf((PyDictObject *)od); res += sizeof(_ODictNode *) * _odict_FAST_SIZE(od); /* od_fast_nodes */ @@ -899,7 +899,7 @@ odict_sizeof(PyODictObject *od) PyDoc_STRVAR(odict_reduce__doc__, "Return state information for pickling"); static PyObject * -odict_reduce(register PyODictObject *od) +odict_reduce(register PyODictObject *od, PyObject *Py_UNUSED(ignored)) { _Py_IDENTIFIER(__dict__); _Py_IDENTIFIER(items); @@ -1143,21 +1143,21 @@ OrderedDict_popitem_impl(PyODictObject *self, int last) /* MutableMapping.keys() does not have a docstring. */ PyDoc_STRVAR(odict_keys__doc__, ""); -static PyObject * odictkeys_new(PyObject *od); /* forward */ +static PyObject * odictkeys_new(PyObject *od, PyObject *Py_UNUSED(ignored)); /* forward */ /* values() */ /* MutableMapping.values() does not have a docstring. */ PyDoc_STRVAR(odict_values__doc__, ""); -static PyObject * odictvalues_new(PyObject *od); /* forward */ +static PyObject * odictvalues_new(PyObject *od, PyObject *Py_UNUSED(ignored)); /* forward */ /* items() */ /* MutableMapping.items() does not have a docstring. */ PyDoc_STRVAR(odict_items__doc__, ""); -static PyObject * odictitems_new(PyObject *od); /* forward */ +static PyObject * odictitems_new(PyObject *od, PyObject *Py_UNUSED(ignored)); /* forward */ /* update() */ @@ -1175,7 +1175,7 @@ PyDoc_STRVAR(odict_clear__doc__, "od.clear() -> None. Remove all items from od."); static PyObject * -odict_clear(register PyODictObject *od) +odict_clear(register PyODictObject *od, PyObject *Py_UNUSED(ignored)) { PyDict_Clear((PyObject *)od); _odict_clear_nodes(od); @@ -1193,7 +1193,7 @@ static int _PyODict_SetItem_KnownHash(PyObject *, PyObject *, PyObject *, PyDoc_STRVAR(odict_copy__doc__, "od.copy() -> a shallow copy of od"); static PyObject * -odict_copy(register PyODictObject *od) +odict_copy(register PyODictObject *od, PyObject *Py_UNUSED(ignored)) { _ODictNode *node; PyObject *od_copy; @@ -1252,7 +1252,7 @@ PyDoc_STRVAR(odict_reversed__doc__, "od.__reversed__() <==> reversed(od)"); static PyObject * odictiter_new(PyODictObject *, int); static PyObject * -odict_reversed(PyODictObject *od) +odict_reversed(PyODictObject *od, PyObject *Py_UNUSED(ignored)) { return odictiter_new(od, _odict_ITER_KEYS|_odict_ITER_REVERSED); } @@ -1322,11 +1322,11 @@ static PyMethodDef odict_methods[] = { {"pop", (PyCFunction)odict_pop, METH_VARARGS | METH_KEYWORDS, odict_pop__doc__}, ORDEREDDICT_POPITEM_METHODDEF - {"keys", (PyCFunction)odictkeys_new, METH_NOARGS, + {"keys", odictkeys_new, METH_NOARGS, odict_keys__doc__}, - {"values", (PyCFunction)odictvalues_new, METH_NOARGS, + {"values", odictvalues_new, METH_NOARGS, odict_values__doc__}, - {"items", (PyCFunction)odictitems_new, METH_NOARGS, + {"items", odictitems_new, METH_NOARGS, odict_items__doc__}, {"update", (PyCFunction)odict_update, METH_VARARGS | METH_KEYWORDS, odict_update__doc__}, @@ -1487,7 +1487,7 @@ odict_tp_clear(PyODictObject *od) PyObject *res; Py_CLEAR(od->od_inst_dict); Py_CLEAR(od->od_weakreflist); - res = odict_clear(od); + res = odict_clear(od, NULL); if (res == NULL) return -1; Py_DECREF(res); @@ -1956,7 +1956,7 @@ odictkeys_iter(_PyDictViewObject *dv) } static PyObject * -odictkeys_reversed(_PyDictViewObject *dv) +odictkeys_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored)) { if (dv->dv_dict == NULL) { Py_RETURN_NONE; @@ -2005,7 +2005,7 @@ PyTypeObject PyODictKeys_Type = { }; static PyObject * -odictkeys_new(PyObject *od) +odictkeys_new(PyObject *od, PyObject *Py_UNUSED(ignored)) { return _PyDictView_New(od, &PyODictKeys_Type); } @@ -2023,7 +2023,7 @@ odictitems_iter(_PyDictViewObject *dv) } static PyObject * -odictitems_reversed(_PyDictViewObject *dv) +odictitems_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored)) { if (dv->dv_dict == NULL) { Py_RETURN_NONE; @@ -2072,7 +2072,7 @@ PyTypeObject PyODictItems_Type = { }; static PyObject * -odictitems_new(PyObject *od) +odictitems_new(PyObject *od, PyObject *Py_UNUSED(ignored)) { return _PyDictView_New(od, &PyODictItems_Type); } @@ -2090,7 +2090,7 @@ odictvalues_iter(_PyDictViewObject *dv) } static PyObject * -odictvalues_reversed(_PyDictViewObject *dv) +odictvalues_reversed(_PyDictViewObject *dv, PyObject *Py_UNUSED(ignored)) { if (dv->dv_dict == NULL) { Py_RETURN_NONE; @@ -2139,7 +2139,7 @@ PyTypeObject PyODictValues_Type = { }; static PyObject * -odictvalues_new(PyObject *od) +odictvalues_new(PyObject *od, PyObject *Py_UNUSED(ignored)) { return _PyDictView_New(od, &PyODictValues_Type); } |