bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)
Fix invalid function cast warnings with gcc 8
for method conventions different from METH_NOARGS, METH_O and
METH_VARARGS excluding Argument Clinic generated code.
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2f108bd..72cb4c5 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -3095,15 +3095,15 @@
static PyMethodDef mapp_methods[] = {
DICT___CONTAINS___METHODDEF
- {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST,
+ {"__getitem__", (PyCFunction)(void(*)(void))dict_subscript, METH_O | METH_COEXIST,
getitem__doc__},
- {"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS,
+ {"__sizeof__", (PyCFunction)(void(*)(void))dict_sizeof, METH_NOARGS,
sizeof__doc__},
DICT_GET_METHODDEF
DICT_SETDEFAULT_METHODDEF
{"pop", (PyCFunction)dict_pop, METH_VARARGS,
pop__doc__},
- {"popitem", (PyCFunction)dict_popitem, METH_NOARGS,
+ {"popitem", (PyCFunction)(void(*)(void))dict_popitem, METH_NOARGS,
popitem__doc__},
{"keys", dictkeys_new, METH_NOARGS,
keys__doc__},
@@ -3111,7 +3111,7 @@
items__doc__},
{"values", dictvalues_new, METH_NOARGS,
values__doc__},
- {"update", (PyCFunction)dict_update, METH_VARARGS | METH_KEYWORDS,
+ {"update", (PyCFunction)(void(*)(void))dict_update, METH_VARARGS | METH_KEYWORDS,
update__doc__},
DICT_FROMKEYS_METHODDEF
{"clear", (PyCFunction)dict_clear, METH_NOARGS,
@@ -3420,9 +3420,9 @@
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
static PyMethodDef dictiter_methods[] = {
- {"__length_hint__", (PyCFunction)dictiter_len, METH_NOARGS,
+ {"__length_hint__", (PyCFunction)(void(*)(void))dictiter_len, METH_NOARGS,
length_hint_doc},
- {"__reduce__", (PyCFunction)dictiter_reduce, METH_NOARGS,
+ {"__reduce__", (PyCFunction)(void(*)(void))dictiter_reduce, METH_NOARGS,
reduce_doc},
{NULL, NULL} /* sentinel */
};
@@ -4209,7 +4209,7 @@
static PyMethodDef dictkeys_methods[] = {
{"isdisjoint", (PyCFunction)dictviews_isdisjoint, METH_O,
isdisjoint_doc},
- {"__reversed__", (PyCFunction)dictkeys_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictkeys_reversed, METH_NOARGS,
reversed_keys_doc},
{NULL, NULL} /* sentinel */
};
@@ -4315,7 +4315,7 @@
static PyMethodDef dictitems_methods[] = {
{"isdisjoint", (PyCFunction)dictviews_isdisjoint, METH_O,
isdisjoint_doc},
- {"__reversed__", (PyCFunction)dictitems_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictitems_reversed, METH_NOARGS,
reversed_items_doc},
{NULL, NULL} /* sentinel */
};
@@ -4396,7 +4396,7 @@
"Return a reverse iterator over the dict values.");
static PyMethodDef dictvalues_methods[] = {
- {"__reversed__", (PyCFunction)dictvalues_reversed, METH_NOARGS,
+ {"__reversed__", (PyCFunction)(void(*)(void))dictvalues_reversed, METH_NOARGS,
reversed_values_doc},
{NULL, NULL} /* sentinel */
};