mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
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.
This commit is contained in:
parent
81524022d0
commit
62be74290a
38 changed files with 174 additions and 174 deletions
|
|
@ -514,7 +514,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
|
|||
}
|
||||
|
||||
if (flags & METH_KEYWORDS) {
|
||||
result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs);
|
||||
result = (*(PyCFunctionWithKeywords)(void(*)(void))meth) (self, argstuple, kwargs);
|
||||
}
|
||||
else {
|
||||
result = (*meth) (self, argstuple);
|
||||
|
|
@ -529,7 +529,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
|
|||
goto no_keyword_error;
|
||||
}
|
||||
|
||||
result = (*(_PyCFunctionFast)meth) (self, args, nargs);
|
||||
result = (*(_PyCFunctionFast)(void(*)(void))meth) (self, args, nargs);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -537,7 +537,7 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self,
|
|||
{
|
||||
PyObject *const *stack;
|
||||
PyObject *kwnames;
|
||||
_PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)meth;
|
||||
_PyCFunctionFastWithKeywords fastmeth = (_PyCFunctionFastWithKeywords)(void(*)(void))meth;
|
||||
|
||||
if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) {
|
||||
goto exit;
|
||||
|
|
@ -650,12 +650,12 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
|
|||
if (nkwargs) {
|
||||
goto no_keyword_error;
|
||||
}
|
||||
result = ((_PyCFunctionFast)meth) (self, args, nargs);
|
||||
result = ((_PyCFunctionFast)(void(*)(void))meth) (self, args, nargs);
|
||||
break;
|
||||
|
||||
case METH_FASTCALL | METH_KEYWORDS:
|
||||
/* Fast-path: avoid temporary dict to pass keyword arguments */
|
||||
result = ((_PyCFunctionFastWithKeywords)meth) (self, args, nargs, kwnames);
|
||||
result = ((_PyCFunctionFastWithKeywords)(void(*)(void))meth) (self, args, nargs, kwnames);
|
||||
break;
|
||||
|
||||
case METH_VARARGS:
|
||||
|
|
@ -689,7 +689,7 @@ _PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self,
|
|||
kwdict = NULL;
|
||||
}
|
||||
|
||||
result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict);
|
||||
result = (*(PyCFunctionWithKeywords)(void(*)(void))meth) (self, argtuple, kwdict);
|
||||
Py_XDECREF(kwdict);
|
||||
}
|
||||
else {
|
||||
|
|
@ -752,7 +752,7 @@ cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs);
|
||||
result = (*(PyCFunctionWithKeywords)(void(*)(void))meth)(self, args, kwargs);
|
||||
|
||||
Py_LeaveRecursiveCall();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3095,15 +3095,15 @@ PyDoc_STRVAR(values__doc__,
|
|||
|
||||
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 @@ static PyMethodDef mapp_methods[] = {
|
|||
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 @@ dictiter_reduce(dictiterobject *di, PyObject *Py_UNUSED(ignored));
|
|||
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 @@ PyDoc_STRVAR(reversed_keys_doc,
|
|||
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 @@ PyDoc_STRVAR(reversed_items_doc,
|
|||
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 @@ PyDoc_STRVAR(reversed_values_doc,
|
|||
"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 */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3086,7 +3086,7 @@ static PyMethodDef memory_methods[] = {
|
|||
{"tobytes", (PyCFunction)memory_tobytes, METH_NOARGS, memory_tobytes_doc},
|
||||
{"hex", (PyCFunction)memory_hex, METH_NOARGS, memory_hex_doc},
|
||||
{"tolist", (PyCFunction)memory_tolist, METH_NOARGS, memory_tolist_doc},
|
||||
{"cast", (PyCFunction)memory_cast, METH_VARARGS|METH_KEYWORDS, memory_cast_doc},
|
||||
{"cast", (PyCFunction)(void(*)(void))memory_cast, METH_VARARGS|METH_KEYWORDS, memory_cast_doc},
|
||||
{"toreadonly", (PyCFunction)memory_toreadonly, METH_NOARGS, memory_toreadonly_doc},
|
||||
{"__enter__", memory_enter, METH_NOARGS, NULL},
|
||||
{"__exit__", memory_exit, METH_VARARGS, NULL},
|
||||
|
|
|
|||
|
|
@ -1311,7 +1311,7 @@ static PyMethodDef odict_methods[] = {
|
|||
{"__reduce__", (PyCFunction)odict_reduce, METH_NOARGS,
|
||||
odict_reduce__doc__},
|
||||
ORDEREDDICT_SETDEFAULT_METHODDEF
|
||||
{"pop", (PyCFunction)odict_pop,
|
||||
{"pop", (PyCFunction)(void(*)(void))odict_pop,
|
||||
METH_VARARGS | METH_KEYWORDS, odict_pop__doc__},
|
||||
ORDEREDDICT_POPITEM_METHODDEF
|
||||
{"keys", odictkeys_new, METH_NOARGS,
|
||||
|
|
@ -1320,7 +1320,7 @@ static PyMethodDef odict_methods[] = {
|
|||
odict_values__doc__},
|
||||
{"items", odictitems_new, METH_NOARGS,
|
||||
odict_items__doc__},
|
||||
{"update", (PyCFunction)odict_update, METH_VARARGS | METH_KEYWORDS,
|
||||
{"update", (PyCFunction)(void(*)(void))odict_update, METH_VARARGS | METH_KEYWORDS,
|
||||
odict_update__doc__},
|
||||
{"clear", (PyCFunction)odict_clear, METH_NOARGS,
|
||||
odict_clear__doc__},
|
||||
|
|
|
|||
|
|
@ -3481,7 +3481,7 @@ type___sizeof___impl(PyTypeObject *self)
|
|||
static PyMethodDef type_methods[] = {
|
||||
TYPE_MRO_METHODDEF
|
||||
TYPE___SUBCLASSES___METHODDEF
|
||||
{"__prepare__", (PyCFunction)type_prepare,
|
||||
{"__prepare__", (PyCFunction)(void(*)(void))type_prepare,
|
||||
METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
|
||||
PyDoc_STR("__prepare__() -> dict\n"
|
||||
"used to create the namespace for the class statement")},
|
||||
|
|
@ -5944,7 +5944,7 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
static struct PyMethodDef tp_new_methoddef[] = {
|
||||
{"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
|
||||
{"__new__", (PyCFunction)(void(*)(void))tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
|
||||
PyDoc_STR("__new__($type, *args, **kwargs)\n--\n\n"
|
||||
"Create and return a new object. "
|
||||
"See help(type) for accurate signature.")},
|
||||
|
|
@ -7140,7 +7140,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
|
|||
}
|
||||
else if (Py_TYPE(descr) == &PyCFunction_Type &&
|
||||
PyCFunction_GET_FUNCTION(descr) ==
|
||||
(PyCFunction)tp_new_wrapper &&
|
||||
(PyCFunction)(void(*)(void))tp_new_wrapper &&
|
||||
ptr == (void**)&type->tp_new)
|
||||
{
|
||||
/* The __new__ wrapper is not a wrapper descriptor,
|
||||
|
|
|
|||
|
|
@ -13948,7 +13948,7 @@ static PyMethodDef unicode_methods[] = {
|
|||
UNICODE_ISIDENTIFIER_METHODDEF
|
||||
UNICODE_ISPRINTABLE_METHODDEF
|
||||
UNICODE_ZFILL_METHODDEF
|
||||
{"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
|
||||
{"format", (PyCFunction)(void(*)(void)) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
|
||||
{"format_map", (PyCFunction) do_string_format_map, METH_O, format_map__doc__},
|
||||
UNICODE___FORMAT___METHODDEF
|
||||
UNICODE_MAKETRANS_METHODDEF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue