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:
Victor Stinner 2022-05-03 21:42:14 +02:00 committed by GitHub
parent 551d02b3e6
commit 804f2529d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 146 additions and 146 deletions

View file

@ -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 */