mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-47164: Add _PyCFunction_CAST() macro (GH-32192)
Use the macro in C files of the Python/ directory.
This commit is contained in:
parent
c14d7e4b81
commit
f0bc694856
8 changed files with 57 additions and 36 deletions
|
@ -613,7 +613,7 @@ filter_reduce(filterobject *lz, PyObject *Py_UNUSED(ignored))
|
|||
PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
|
||||
|
||||
static PyMethodDef filter_methods[] = {
|
||||
{"__reduce__", (PyCFunction)filter_reduce, METH_NOARGS, reduce_doc},
|
||||
{"__reduce__", _PyCFunction_CAST(filter_reduce), METH_NOARGS, reduce_doc},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ map_reduce(mapobject *lz, PyObject *Py_UNUSED(ignored))
|
|||
}
|
||||
|
||||
static PyMethodDef map_methods[] = {
|
||||
{"__reduce__", (PyCFunction)map_reduce, METH_NOARGS, reduce_doc},
|
||||
{"__reduce__", _PyCFunction_CAST(map_reduce), METH_NOARGS, reduce_doc},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ PyDoc_STRVAR(builtin_sorted__doc__,
|
|||
"reverse flag can be set to request the result in descending order.");
|
||||
|
||||
#define BUILTIN_SORTED_METHODDEF \
|
||||
{"sorted", (PyCFunction)(void(*)(void))builtin_sorted, METH_FASTCALL | METH_KEYWORDS, builtin_sorted__doc__},
|
||||
{"sorted", _PyCFunction_CAST(builtin_sorted), METH_FASTCALL | METH_KEYWORDS, builtin_sorted__doc__},
|
||||
|
||||
static PyObject *
|
||||
builtin_sorted(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
|
||||
|
@ -2839,8 +2839,8 @@ zip_setstate(zipobject *lz, PyObject *state)
|
|||
}
|
||||
|
||||
static PyMethodDef zip_methods[] = {
|
||||
{"__reduce__", (PyCFunction)zip_reduce, METH_NOARGS, reduce_doc},
|
||||
{"__setstate__", (PyCFunction)zip_setstate, METH_O, setstate_doc},
|
||||
{"__reduce__", _PyCFunction_CAST(zip_reduce), METH_NOARGS, reduce_doc},
|
||||
{"__setstate__", _PyCFunction_CAST(zip_setstate), METH_O, setstate_doc},
|
||||
{NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -2904,7 +2904,7 @@ PyTypeObject PyZip_Type = {
|
|||
|
||||
|
||||
static PyMethodDef builtin_methods[] = {
|
||||
{"__build_class__", (PyCFunction)(void(*)(void))builtin___build_class__,
|
||||
{"__build_class__", _PyCFunction_CAST(builtin___build_class__),
|
||||
METH_FASTCALL | METH_KEYWORDS, build_class_doc},
|
||||
BUILTIN___IMPORT___METHODDEF
|
||||
BUILTIN_ABS_METHODDEF
|
||||
|
@ -2912,17 +2912,17 @@ static PyMethodDef builtin_methods[] = {
|
|||
BUILTIN_ANY_METHODDEF
|
||||
BUILTIN_ASCII_METHODDEF
|
||||
BUILTIN_BIN_METHODDEF
|
||||
{"breakpoint", (PyCFunction)(void(*)(void))builtin_breakpoint, METH_FASTCALL | METH_KEYWORDS, breakpoint_doc},
|
||||
{"breakpoint", _PyCFunction_CAST(builtin_breakpoint), METH_FASTCALL | METH_KEYWORDS, breakpoint_doc},
|
||||
BUILTIN_CALLABLE_METHODDEF
|
||||
BUILTIN_CHR_METHODDEF
|
||||
BUILTIN_COMPILE_METHODDEF
|
||||
BUILTIN_DELATTR_METHODDEF
|
||||
{"dir", builtin_dir, METH_VARARGS, dir_doc},
|
||||
{"dir", builtin_dir, METH_VARARGS, dir_doc},
|
||||
BUILTIN_DIVMOD_METHODDEF
|
||||
BUILTIN_EVAL_METHODDEF
|
||||
BUILTIN_EXEC_METHODDEF
|
||||
BUILTIN_FORMAT_METHODDEF
|
||||
{"getattr", (PyCFunction)(void(*)(void))builtin_getattr, METH_FASTCALL, getattr_doc},
|
||||
{"getattr", _PyCFunction_CAST(builtin_getattr), METH_FASTCALL, getattr_doc},
|
||||
BUILTIN_GLOBALS_METHODDEF
|
||||
BUILTIN_HASATTR_METHODDEF
|
||||
BUILTIN_HASH_METHODDEF
|
||||
|
@ -2931,13 +2931,13 @@ static PyMethodDef builtin_methods[] = {
|
|||
BUILTIN_INPUT_METHODDEF
|
||||
BUILTIN_ISINSTANCE_METHODDEF
|
||||
BUILTIN_ISSUBCLASS_METHODDEF
|
||||
{"iter", (PyCFunction)(void(*)(void))builtin_iter, METH_FASTCALL, iter_doc},
|
||||
{"iter", _PyCFunction_CAST(builtin_iter), METH_FASTCALL, iter_doc},
|
||||
BUILTIN_AITER_METHODDEF
|
||||
BUILTIN_LEN_METHODDEF
|
||||
BUILTIN_LOCALS_METHODDEF
|
||||
{"max", (PyCFunction)(void(*)(void))builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc},
|
||||
{"min", (PyCFunction)(void(*)(void))builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc},
|
||||
{"next", (PyCFunction)(void(*)(void))builtin_next, METH_FASTCALL, next_doc},
|
||||
{"max", _PyCFunction_CAST(builtin_max), METH_VARARGS | METH_KEYWORDS, max_doc},
|
||||
{"min", _PyCFunction_CAST(builtin_min), METH_VARARGS | METH_KEYWORDS, min_doc},
|
||||
{"next", _PyCFunction_CAST(builtin_next), METH_FASTCALL, next_doc},
|
||||
BUILTIN_ANEXT_METHODDEF
|
||||
BUILTIN_OCT_METHODDEF
|
||||
BUILTIN_ORD_METHODDEF
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue