mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-91320: Use _PyCFunction_CAST() (#92251)
Replace "(PyCFunction)(void(*)(void))func" cast with _PyCFunction_CAST(func). Change generated by the command: sed -i -e \ 's!(PyCFunction)(void(\*)(void)) *\([A-Za-z0-9_]\+\)!_PyCFunction_CAST(\1)!g' \ $(find -name "*.c")
This commit is contained in:
parent
551d02b3e6
commit
804f2529d8
31 changed files with 146 additions and 146 deletions
|
@ -1145,7 +1145,7 @@ mappingproxy_reversed(mappingproxyobject *pp, PyObject *Py_UNUSED(ignored))
|
|||
to the underlying mapping */
|
||||
|
||||
static PyMethodDef mappingproxy_methods[] = {
|
||||
{"get", (PyCFunction)(void(*)(void))mappingproxy_get, METH_FASTCALL,
|
||||
{"get", _PyCFunction_CAST(mappingproxy_get), METH_FASTCALL,
|
||||
PyDoc_STR("D.get(k[,d]) -> D[k] if k in D, else d."
|
||||
" d defaults to None.")},
|
||||
{"keys", (PyCFunction)mappingproxy_keys, METH_NOARGS,
|
||||
|
|
|
@ -3655,9 +3655,9 @@ PyDoc_STRVAR(values__doc__,
|
|||
|
||||
static PyMethodDef mapp_methods[] = {
|
||||
DICT___CONTAINS___METHODDEF
|
||||
{"__getitem__", (PyCFunction)(void(*)(void))dict_subscript, METH_O | METH_COEXIST,
|
||||
{"__getitem__", _PyCFunction_CAST(dict_subscript), METH_O | METH_COEXIST,
|
||||
getitem__doc__},
|
||||
{"__sizeof__", (PyCFunction)(void(*)(void))dict_sizeof, METH_NOARGS,
|
||||
{"__sizeof__", _PyCFunction_CAST(dict_sizeof), METH_NOARGS,
|
||||
sizeof__doc__},
|
||||
DICT_GET_METHODDEF
|
||||
DICT_SETDEFAULT_METHODDEF
|
||||
|
@ -3669,7 +3669,7 @@ static PyMethodDef mapp_methods[] = {
|
|||
items__doc__},
|
||||
{"values", dictvalues_new, METH_NOARGS,
|
||||
values__doc__},
|
||||
{"update", (PyCFunction)(void(*)(void))dict_update, METH_VARARGS | METH_KEYWORDS,
|
||||
{"update", _PyCFunction_CAST(dict_update), METH_VARARGS | METH_KEYWORDS,
|
||||
update__doc__},
|
||||
DICT_FROMKEYS_METHODDEF
|
||||
{"clear", (PyCFunction)dict_clear, METH_NOARGS,
|
||||
|
@ -4026,9 +4026,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)(void(*)(void))dictiter_len, METH_NOARGS,
|
||||
{"__length_hint__", _PyCFunction_CAST(dictiter_len), METH_NOARGS,
|
||||
length_hint_doc},
|
||||
{"__reduce__", (PyCFunction)(void(*)(void))dictiter_reduce, METH_NOARGS,
|
||||
{"__reduce__", _PyCFunction_CAST(dictiter_reduce), METH_NOARGS,
|
||||
reduce_doc},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
@ -5079,7 +5079,7 @@ PyDoc_STRVAR(reversed_keys_doc,
|
|||
static PyMethodDef dictkeys_methods[] = {
|
||||
{"isdisjoint", (PyCFunction)dictviews_isdisjoint, METH_O,
|
||||
isdisjoint_doc},
|
||||
{"__reversed__", (PyCFunction)(void(*)(void))dictkeys_reversed, METH_NOARGS,
|
||||
{"__reversed__", _PyCFunction_CAST(dictkeys_reversed), METH_NOARGS,
|
||||
reversed_keys_doc},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
|
|
@ -821,7 +821,7 @@ PyDoc_STRVAR(sizeof__doc__,
|
|||
|
||||
static PyMethodDef gen_methods[] = {
|
||||
{"send",(PyCFunction)gen_send, METH_O, send_doc},
|
||||
{"throw",(PyCFunction)(void(*)(void))gen_throw, METH_FASTCALL, throw_doc},
|
||||
{"throw",_PyCFunction_CAST(gen_throw), METH_FASTCALL, throw_doc},
|
||||
{"close",(PyCFunction)gen_close, METH_NOARGS, close_doc},
|
||||
{"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
|
@ -1169,7 +1169,7 @@ PyDoc_STRVAR(coro_close_doc,
|
|||
|
||||
static PyMethodDef coro_methods[] = {
|
||||
{"send",(PyCFunction)gen_send, METH_O, coro_send_doc},
|
||||
{"throw",(PyCFunction)(void(*)(void))gen_throw, METH_FASTCALL, coro_throw_doc},
|
||||
{"throw",_PyCFunction_CAST(gen_throw), METH_FASTCALL, coro_throw_doc},
|
||||
{"close",(PyCFunction)gen_close, METH_NOARGS, coro_close_doc},
|
||||
{"__sizeof__", (PyCFunction)gen_sizeof, METH_NOARGS, sizeof__doc__},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
|
@ -1276,7 +1276,7 @@ coro_wrapper_traverse(PyCoroWrapper *cw, visitproc visit, void *arg)
|
|||
|
||||
static PyMethodDef coro_wrapper_methods[] = {
|
||||
{"send",(PyCFunction)coro_wrapper_send, METH_O, coro_send_doc},
|
||||
{"throw",(PyCFunction)(void(*)(void))coro_wrapper_throw,
|
||||
{"throw",_PyCFunction_CAST(coro_wrapper_throw),
|
||||
METH_FASTCALL, coro_throw_doc},
|
||||
{"close",(PyCFunction)coro_wrapper_close, METH_NOARGS, coro_close_doc},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
|
@ -1831,7 +1831,7 @@ async_gen_asend_close(PyAsyncGenASend *o, PyObject *args)
|
|||
|
||||
static PyMethodDef async_gen_asend_methods[] = {
|
||||
{"send", (PyCFunction)async_gen_asend_send, METH_O, send_doc},
|
||||
{"throw", (PyCFunction)(void(*)(void))async_gen_asend_throw, METH_FASTCALL, throw_doc},
|
||||
{"throw", _PyCFunction_CAST(async_gen_asend_throw), METH_FASTCALL, throw_doc},
|
||||
{"close", (PyCFunction)async_gen_asend_close, METH_NOARGS, close_doc},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
};
|
||||
|
@ -2248,7 +2248,7 @@ async_gen_athrow_close(PyAsyncGenAThrow *o, PyObject *args)
|
|||
|
||||
static PyMethodDef async_gen_athrow_methods[] = {
|
||||
{"send", (PyCFunction)async_gen_athrow_send, METH_O, send_doc},
|
||||
{"throw", (PyCFunction)(void(*)(void))async_gen_athrow_throw,
|
||||
{"throw", _PyCFunction_CAST(async_gen_athrow_throw),
|
||||
METH_FASTCALL, throw_doc},
|
||||
{"close", (PyCFunction)async_gen_athrow_close, METH_NOARGS, close_doc},
|
||||
{NULL, NULL} /* Sentinel */
|
||||
|
|
|
@ -1317,7 +1317,7 @@ static PyMethodDef odict_methods[] = {
|
|||
odict_values__doc__},
|
||||
{"items", odictitems_new, METH_NOARGS,
|
||||
odict_items__doc__},
|
||||
{"update", (PyCFunction)(void(*)(void))odict_update, METH_VARARGS | METH_KEYWORDS,
|
||||
{"update", _PyCFunction_CAST(odict_update), METH_VARARGS | METH_KEYWORDS,
|
||||
odict_update__doc__},
|
||||
{"clear", (PyCFunction)odict_clear, METH_NOARGS,
|
||||
odict_clear__doc__},
|
||||
|
|
|
@ -4289,7 +4289,7 @@ type___sizeof___impl(PyTypeObject *self)
|
|||
static PyMethodDef type_methods[] = {
|
||||
TYPE_MRO_METHODDEF
|
||||
TYPE___SUBCLASSES___METHODDEF
|
||||
{"__prepare__", (PyCFunction)(void(*)(void))type_prepare,
|
||||
{"__prepare__", _PyCFunction_CAST(type_prepare),
|
||||
METH_FASTCALL | METH_KEYWORDS | METH_CLASS,
|
||||
PyDoc_STR("__prepare__() -> dict\n"
|
||||
"used to create the namespace for the class statement")},
|
||||
|
@ -7141,7 +7141,7 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
static struct PyMethodDef tp_new_methoddef[] = {
|
||||
{"__new__", (PyCFunction)(void(*)(void))tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
|
||||
{"__new__", _PyCFunction_CAST(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.")},
|
||||
|
@ -8390,7 +8390,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
|
|||
}
|
||||
else if (Py_IS_TYPE(descr, &PyCFunction_Type) &&
|
||||
PyCFunction_GET_FUNCTION(descr) ==
|
||||
(PyCFunction)(void(*)(void))tp_new_wrapper &&
|
||||
_PyCFunction_CAST(tp_new_wrapper) &&
|
||||
ptr == (void**)&type->tp_new)
|
||||
{
|
||||
/* The __new__ wrapper is not a wrapper descriptor,
|
||||
|
|
|
@ -14214,7 +14214,7 @@ static PyMethodDef unicode_methods[] = {
|
|||
UNICODE_ISIDENTIFIER_METHODDEF
|
||||
UNICODE_ISPRINTABLE_METHODDEF
|
||||
UNICODE_ZFILL_METHODDEF
|
||||
{"format", (PyCFunction)(void(*)(void)) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
|
||||
{"format", _PyCFunction_CAST(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