Skip to content

Commit

Permalink
gh-91320: Use _PyCFunction_CAST() (#92251)
Browse files Browse the repository at this point in the history
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")
  • Loading branch information
vstinner authored May 3, 2022
1 parent 551d02b commit 804f252
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 146 deletions.
2 changes: 1 addition & 1 deletion Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1724,7 +1724,7 @@ FutureIter_traverse(futureiterobject *it, visitproc visit, void *arg)

static PyMethodDef FutureIter_methods[] = {
{"send", (PyCFunction)FutureIter_send, METH_O, NULL},
{"throw", (PyCFunction)(void(*)(void))FutureIter_throw, METH_FASTCALL, NULL},
{"throw", _PyCFunction_CAST(FutureIter_throw), METH_FASTCALL, NULL},
{"close", (PyCFunction)FutureIter_close, METH_NOARGS, NULL},
{NULL, NULL} /* Sentinel */
};
Expand Down
6 changes: 3 additions & 3 deletions Modules/_collectionsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,9 @@ static PyMethodDef deque_methods[] = {
METH_O, extend_doc},
{"extendleft", (PyCFunction)deque_extendleft,
METH_O, extendleft_doc},
{"index", (PyCFunction)(void(*)(void))deque_index,
{"index", _PyCFunction_CAST(deque_index),
METH_FASTCALL, index_doc},
{"insert", (PyCFunction)(void(*)(void))deque_insert,
{"insert", _PyCFunction_CAST(deque_insert),
METH_FASTCALL, insert_doc},
{"pop", (PyCFunction)deque_pop,
METH_NOARGS, pop_doc},
Expand All @@ -1604,7 +1604,7 @@ static PyMethodDef deque_methods[] = {
METH_NOARGS, reversed_doc},
{"reverse", (PyCFunction)deque_reverse,
METH_NOARGS, reverse_doc},
{"rotate", (PyCFunction)(void(*)(void))deque_rotate,
{"rotate", _PyCFunction_CAST(deque_rotate),
METH_FASTCALL, rotate_doc},
{"__sizeof__", (PyCFunction)deque_sizeof,
METH_NOARGS, sizeof_doc},
Expand Down
6 changes: 3 additions & 3 deletions Modules/_csv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,11 +1704,11 @@ PyDoc_STRVAR(csv_register_dialect_doc,
" dialect = csv.register_dialect(name[, dialect[, **fmtparams]])");

static struct PyMethodDef csv_methods[] = {
{ "reader", (PyCFunction)(void(*)(void))csv_reader,
{ "reader", _PyCFunction_CAST(csv_reader),
METH_VARARGS | METH_KEYWORDS, csv_reader_doc},
{ "writer", (PyCFunction)(void(*)(void))csv_writer,
{ "writer", _PyCFunction_CAST(csv_writer),
METH_VARARGS | METH_KEYWORDS, csv_writer_doc},
{ "register_dialect", (PyCFunction)(void(*)(void))csv_register_dialect,
{ "register_dialect", _PyCFunction_CAST(csv_register_dialect),
METH_VARARGS | METH_KEYWORDS, csv_register_dialect_doc},
_CSV_LIST_DIALECTS_METHODDEF
_CSV_UNREGISTER_DIALECT_METHODDEF
Expand Down
22 changes: 11 additions & 11 deletions Modules/_datetimemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3491,7 +3491,7 @@ static PyMethodDef date_methods[] = {
METH_CLASS,
PyDoc_STR("str -> Construct a date from the output of date.isoformat()")},

{"fromisocalendar", (PyCFunction)(void(*)(void))date_fromisocalendar,
{"fromisocalendar", _PyCFunction_CAST(date_fromisocalendar),
METH_VARARGS | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("int, int, int -> Construct a date from the ISO year, week "
"number and weekday.\n\n"
Expand All @@ -3506,7 +3506,7 @@ static PyMethodDef date_methods[] = {
{"ctime", (PyCFunction)date_ctime, METH_NOARGS,
PyDoc_STR("Return ctime() style string.")},

{"strftime", (PyCFunction)(void(*)(void))date_strftime, METH_VARARGS | METH_KEYWORDS,
{"strftime", _PyCFunction_CAST(date_strftime), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("format -> strftime() style string.")},

{"__format__", (PyCFunction)date_format, METH_VARARGS,
Expand Down Expand Up @@ -3534,7 +3534,7 @@ static PyMethodDef date_methods[] = {
PyDoc_STR("Return the day of the week represented by the date.\n"
"Monday == 0 ... Sunday == 6")},

{"replace", (PyCFunction)(void(*)(void))date_replace, METH_VARARGS | METH_KEYWORDS,
{"replace", _PyCFunction_CAST(date_replace), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Return date with new specified fields.")},

{"__reduce__", (PyCFunction)date_reduce, METH_NOARGS,
Expand Down Expand Up @@ -4644,15 +4644,15 @@ time_reduce(PyDateTime_Time *self, PyObject *arg)

static PyMethodDef time_methods[] = {

{"isoformat", (PyCFunction)(void(*)(void))time_isoformat, METH_VARARGS | METH_KEYWORDS,
{"isoformat", _PyCFunction_CAST(time_isoformat), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]]"
"[+HH:MM].\n\n"
"The optional argument timespec specifies the number "
"of additional terms\nof the time to include. Valid "
"options are 'auto', 'hours', 'minutes',\n'seconds', "
"'milliseconds' and 'microseconds'.\n")},

{"strftime", (PyCFunction)(void(*)(void))time_strftime, METH_VARARGS | METH_KEYWORDS,
{"strftime", _PyCFunction_CAST(time_strftime), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("format -> strftime() style string.")},

{"__format__", (PyCFunction)date_format, METH_VARARGS,
Expand All @@ -4667,7 +4667,7 @@ static PyMethodDef time_methods[] = {
{"dst", (PyCFunction)time_dst, METH_NOARGS,
PyDoc_STR("Return self.tzinfo.dst(self).")},

{"replace", (PyCFunction)(void(*)(void))time_replace, METH_VARARGS | METH_KEYWORDS,
{"replace", _PyCFunction_CAST(time_replace), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Return time with new specified fields.")},

{"fromisoformat", (PyCFunction)time_fromisoformat, METH_O | METH_CLASS,
Expand Down Expand Up @@ -6308,7 +6308,7 @@ static PyMethodDef datetime_methods[] = {
METH_NOARGS | METH_CLASS,
PyDoc_STR("Return a new datetime representing UTC day and time.")},

{"fromtimestamp", (PyCFunction)(void(*)(void))datetime_fromtimestamp,
{"fromtimestamp", _PyCFunction_CAST(datetime_fromtimestamp),
METH_VARARGS | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("timestamp[, tz] -> tz's local time from POSIX timestamp.")},

Expand All @@ -6321,7 +6321,7 @@ static PyMethodDef datetime_methods[] = {
PyDoc_STR("string, format -> new datetime parsed from a string "
"(like time.strptime()).")},

{"combine", (PyCFunction)(void(*)(void))datetime_combine,
{"combine", _PyCFunction_CAST(datetime_combine),
METH_VARARGS | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("date, time -> datetime with same date and time fields")},

Expand Down Expand Up @@ -6352,7 +6352,7 @@ static PyMethodDef datetime_methods[] = {
{"utctimetuple", (PyCFunction)datetime_utctimetuple, METH_NOARGS,
PyDoc_STR("Return UTC time tuple, compatible with time.localtime().")},

{"isoformat", (PyCFunction)(void(*)(void))datetime_isoformat, METH_VARARGS | METH_KEYWORDS,
{"isoformat", _PyCFunction_CAST(datetime_isoformat), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("[sep] -> string in ISO 8601 format, "
"YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].\n"
"sep is used to separate the year from the time, and "
Expand All @@ -6371,10 +6371,10 @@ static PyMethodDef datetime_methods[] = {
{"dst", (PyCFunction)datetime_dst, METH_NOARGS,
PyDoc_STR("Return self.tzinfo.dst(self).")},

{"replace", (PyCFunction)(void(*)(void))datetime_replace, METH_VARARGS | METH_KEYWORDS,
{"replace", _PyCFunction_CAST(datetime_replace), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Return datetime with new specified fields.")},

{"astimezone", (PyCFunction)(void(*)(void))datetime_astimezone, METH_VARARGS | METH_KEYWORDS,
{"astimezone", _PyCFunction_CAST(datetime_astimezone), METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("tz -> convert to local time in new timezone tz\n")},

{"__reduce_ex__", (PyCFunction)datetime_reduce_ex, METH_VARARGS,
Expand Down
76 changes: 38 additions & 38 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4904,30 +4904,30 @@ static PyNumberMethods dec_number_methods =
static PyMethodDef dec_methods [] =
{
/* Unary arithmetic functions, optional context arg */
{ "exp", (PyCFunction)(void(*)(void))dec_mpd_qexp, METH_VARARGS|METH_KEYWORDS, doc_exp },
{ "ln", (PyCFunction)(void(*)(void))dec_mpd_qln, METH_VARARGS|METH_KEYWORDS, doc_ln },
{ "log10", (PyCFunction)(void(*)(void))dec_mpd_qlog10, METH_VARARGS|METH_KEYWORDS, doc_log10 },
{ "next_minus", (PyCFunction)(void(*)(void))dec_mpd_qnext_minus, METH_VARARGS|METH_KEYWORDS, doc_next_minus },
{ "next_plus", (PyCFunction)(void(*)(void))dec_mpd_qnext_plus, METH_VARARGS|METH_KEYWORDS, doc_next_plus },
{ "normalize", (PyCFunction)(void(*)(void))dec_mpd_qreduce, METH_VARARGS|METH_KEYWORDS, doc_normalize },
{ "to_integral", (PyCFunction)(void(*)(void))PyDec_ToIntegralValue, METH_VARARGS|METH_KEYWORDS, doc_to_integral },
{ "to_integral_exact", (PyCFunction)(void(*)(void))PyDec_ToIntegralExact, METH_VARARGS|METH_KEYWORDS, doc_to_integral_exact },
{ "to_integral_value", (PyCFunction)(void(*)(void))PyDec_ToIntegralValue, METH_VARARGS|METH_KEYWORDS, doc_to_integral_value },
{ "sqrt", (PyCFunction)(void(*)(void))dec_mpd_qsqrt, METH_VARARGS|METH_KEYWORDS, doc_sqrt },
{ "exp", _PyCFunction_CAST(dec_mpd_qexp), METH_VARARGS|METH_KEYWORDS, doc_exp },
{ "ln", _PyCFunction_CAST(dec_mpd_qln), METH_VARARGS|METH_KEYWORDS, doc_ln },
{ "log10", _PyCFunction_CAST(dec_mpd_qlog10), METH_VARARGS|METH_KEYWORDS, doc_log10 },
{ "next_minus", _PyCFunction_CAST(dec_mpd_qnext_minus), METH_VARARGS|METH_KEYWORDS, doc_next_minus },
{ "next_plus", _PyCFunction_CAST(dec_mpd_qnext_plus), METH_VARARGS|METH_KEYWORDS, doc_next_plus },
{ "normalize", _PyCFunction_CAST(dec_mpd_qreduce), METH_VARARGS|METH_KEYWORDS, doc_normalize },
{ "to_integral", _PyCFunction_CAST(PyDec_ToIntegralValue), METH_VARARGS|METH_KEYWORDS, doc_to_integral },
{ "to_integral_exact", _PyCFunction_CAST(PyDec_ToIntegralExact), METH_VARARGS|METH_KEYWORDS, doc_to_integral_exact },
{ "to_integral_value", _PyCFunction_CAST(PyDec_ToIntegralValue), METH_VARARGS|METH_KEYWORDS, doc_to_integral_value },
{ "sqrt", _PyCFunction_CAST(dec_mpd_qsqrt), METH_VARARGS|METH_KEYWORDS, doc_sqrt },

/* Binary arithmetic functions, optional context arg */
{ "compare", (PyCFunction)(void(*)(void))dec_mpd_qcompare, METH_VARARGS|METH_KEYWORDS, doc_compare },
{ "compare_signal", (PyCFunction)(void(*)(void))dec_mpd_qcompare_signal, METH_VARARGS|METH_KEYWORDS, doc_compare_signal },
{ "max", (PyCFunction)(void(*)(void))dec_mpd_qmax, METH_VARARGS|METH_KEYWORDS, doc_max },
{ "max_mag", (PyCFunction)(void(*)(void))dec_mpd_qmax_mag, METH_VARARGS|METH_KEYWORDS, doc_max_mag },
{ "min", (PyCFunction)(void(*)(void))dec_mpd_qmin, METH_VARARGS|METH_KEYWORDS, doc_min },
{ "min_mag", (PyCFunction)(void(*)(void))dec_mpd_qmin_mag, METH_VARARGS|METH_KEYWORDS, doc_min_mag },
{ "next_toward", (PyCFunction)(void(*)(void))dec_mpd_qnext_toward, METH_VARARGS|METH_KEYWORDS, doc_next_toward },
{ "quantize", (PyCFunction)(void(*)(void))dec_mpd_qquantize, METH_VARARGS|METH_KEYWORDS, doc_quantize },
{ "remainder_near", (PyCFunction)(void(*)(void))dec_mpd_qrem_near, METH_VARARGS|METH_KEYWORDS, doc_remainder_near },
{ "compare", _PyCFunction_CAST(dec_mpd_qcompare), METH_VARARGS|METH_KEYWORDS, doc_compare },
{ "compare_signal", _PyCFunction_CAST(dec_mpd_qcompare_signal), METH_VARARGS|METH_KEYWORDS, doc_compare_signal },
{ "max", _PyCFunction_CAST(dec_mpd_qmax), METH_VARARGS|METH_KEYWORDS, doc_max },
{ "max_mag", _PyCFunction_CAST(dec_mpd_qmax_mag), METH_VARARGS|METH_KEYWORDS, doc_max_mag },
{ "min", _PyCFunction_CAST(dec_mpd_qmin), METH_VARARGS|METH_KEYWORDS, doc_min },
{ "min_mag", _PyCFunction_CAST(dec_mpd_qmin_mag), METH_VARARGS|METH_KEYWORDS, doc_min_mag },
{ "next_toward", _PyCFunction_CAST(dec_mpd_qnext_toward), METH_VARARGS|METH_KEYWORDS, doc_next_toward },
{ "quantize", _PyCFunction_CAST(dec_mpd_qquantize), METH_VARARGS|METH_KEYWORDS, doc_quantize },
{ "remainder_near", _PyCFunction_CAST(dec_mpd_qrem_near), METH_VARARGS|METH_KEYWORDS, doc_remainder_near },

/* Ternary arithmetic functions, optional context arg */
{ "fma", (PyCFunction)(void(*)(void))dec_mpd_qfma, METH_VARARGS|METH_KEYWORDS, doc_fma },
{ "fma", _PyCFunction_CAST(dec_mpd_qfma), METH_VARARGS|METH_KEYWORDS, doc_fma },

/* Boolean functions, no context arg */
{ "is_canonical", dec_mpd_iscanonical, METH_NOARGS, doc_is_canonical },
Expand All @@ -4940,8 +4940,8 @@ static PyMethodDef dec_methods [] =
{ "is_zero", dec_mpd_iszero, METH_NOARGS, doc_is_zero },

/* Boolean functions, optional context arg */
{ "is_normal", (PyCFunction)(void(*)(void))dec_mpd_isnormal, METH_VARARGS|METH_KEYWORDS, doc_is_normal },
{ "is_subnormal", (PyCFunction)(void(*)(void))dec_mpd_issubnormal, METH_VARARGS|METH_KEYWORDS, doc_is_subnormal },
{ "is_normal", _PyCFunction_CAST(dec_mpd_isnormal), METH_VARARGS|METH_KEYWORDS, doc_is_normal },
{ "is_subnormal", _PyCFunction_CAST(dec_mpd_issubnormal), METH_VARARGS|METH_KEYWORDS, doc_is_subnormal },

/* Unary functions, no context arg */
{ "adjusted", dec_mpd_adjexp, METH_NOARGS, doc_adjusted },
Expand All @@ -4954,24 +4954,24 @@ static PyMethodDef dec_methods [] =
{ "copy_negate", dec_mpd_qcopy_negate, METH_NOARGS, doc_copy_negate },

/* Unary functions, optional context arg */
{ "logb", (PyCFunction)(void(*)(void))dec_mpd_qlogb, METH_VARARGS|METH_KEYWORDS, doc_logb },
{ "logical_invert", (PyCFunction)(void(*)(void))dec_mpd_qinvert, METH_VARARGS|METH_KEYWORDS, doc_logical_invert },
{ "number_class", (PyCFunction)(void(*)(void))dec_mpd_class, METH_VARARGS|METH_KEYWORDS, doc_number_class },
{ "to_eng_string", (PyCFunction)(void(*)(void))dec_mpd_to_eng, METH_VARARGS|METH_KEYWORDS, doc_to_eng_string },
{ "logb", _PyCFunction_CAST(dec_mpd_qlogb), METH_VARARGS|METH_KEYWORDS, doc_logb },
{ "logical_invert", _PyCFunction_CAST(dec_mpd_qinvert), METH_VARARGS|METH_KEYWORDS, doc_logical_invert },
{ "number_class", _PyCFunction_CAST(dec_mpd_class), METH_VARARGS|METH_KEYWORDS, doc_number_class },
{ "to_eng_string", _PyCFunction_CAST(dec_mpd_to_eng), METH_VARARGS|METH_KEYWORDS, doc_to_eng_string },

/* Binary functions, optional context arg for conversion errors */
{ "compare_total", (PyCFunction)(void(*)(void))dec_mpd_compare_total, METH_VARARGS|METH_KEYWORDS, doc_compare_total },
{ "compare_total_mag", (PyCFunction)(void(*)(void))dec_mpd_compare_total_mag, METH_VARARGS|METH_KEYWORDS, doc_compare_total_mag },
{ "copy_sign", (PyCFunction)(void(*)(void))dec_mpd_qcopy_sign, METH_VARARGS|METH_KEYWORDS, doc_copy_sign },
{ "same_quantum", (PyCFunction)(void(*)(void))dec_mpd_same_quantum, METH_VARARGS|METH_KEYWORDS, doc_same_quantum },
{ "compare_total", _PyCFunction_CAST(dec_mpd_compare_total), METH_VARARGS|METH_KEYWORDS, doc_compare_total },
{ "compare_total_mag", _PyCFunction_CAST(dec_mpd_compare_total_mag), METH_VARARGS|METH_KEYWORDS, doc_compare_total_mag },
{ "copy_sign", _PyCFunction_CAST(dec_mpd_qcopy_sign), METH_VARARGS|METH_KEYWORDS, doc_copy_sign },
{ "same_quantum", _PyCFunction_CAST(dec_mpd_same_quantum), METH_VARARGS|METH_KEYWORDS, doc_same_quantum },

/* Binary functions, optional context arg */
{ "logical_and", (PyCFunction)(void(*)(void))dec_mpd_qand, METH_VARARGS|METH_KEYWORDS, doc_logical_and },
{ "logical_or", (PyCFunction)(void(*)(void))dec_mpd_qor, METH_VARARGS|METH_KEYWORDS, doc_logical_or },
{ "logical_xor", (PyCFunction)(void(*)(void))dec_mpd_qxor, METH_VARARGS|METH_KEYWORDS, doc_logical_xor },
{ "rotate", (PyCFunction)(void(*)(void))dec_mpd_qrotate, METH_VARARGS|METH_KEYWORDS, doc_rotate },
{ "scaleb", (PyCFunction)(void(*)(void))dec_mpd_qscaleb, METH_VARARGS|METH_KEYWORDS, doc_scaleb },
{ "shift", (PyCFunction)(void(*)(void))dec_mpd_qshift, METH_VARARGS|METH_KEYWORDS, doc_shift },
{ "logical_and", _PyCFunction_CAST(dec_mpd_qand), METH_VARARGS|METH_KEYWORDS, doc_logical_and },
{ "logical_or", _PyCFunction_CAST(dec_mpd_qor), METH_VARARGS|METH_KEYWORDS, doc_logical_or },
{ "logical_xor", _PyCFunction_CAST(dec_mpd_qxor), METH_VARARGS|METH_KEYWORDS, doc_logical_xor },
{ "rotate", _PyCFunction_CAST(dec_mpd_qrotate), METH_VARARGS|METH_KEYWORDS, doc_rotate },
{ "scaleb", _PyCFunction_CAST(dec_mpd_qscaleb), METH_VARARGS|METH_KEYWORDS, doc_scaleb },
{ "shift", _PyCFunction_CAST(dec_mpd_qshift), METH_VARARGS|METH_KEYWORDS, doc_shift },

/* Miscellaneous */
{ "from_float", dec_from_float, METH_O|METH_CLASS, doc_from_float },
Expand Down Expand Up @@ -5609,7 +5609,7 @@ static PyMethodDef context_methods [] =
{ "subtract", ctx_mpd_qsub, METH_VARARGS, doc_ctx_subtract },

/* Binary or ternary arithmetic functions */
{ "power", (PyCFunction)(void(*)(void))ctx_mpd_qpow, METH_VARARGS|METH_KEYWORDS, doc_ctx_power },
{ "power", _PyCFunction_CAST(ctx_mpd_qpow), METH_VARARGS|METH_KEYWORDS, doc_ctx_power },

/* Ternary arithmetic functions */
{ "fma", ctx_mpd_qfma, METH_VARARGS, doc_ctx_fma },
Expand Down Expand Up @@ -5727,7 +5727,7 @@ static PyMethodDef _decimal_methods [] =
{
{ "getcontext", (PyCFunction)PyDec_GetCurrentContext, METH_NOARGS, doc_getcontext},
{ "setcontext", (PyCFunction)PyDec_SetCurrentContext, METH_O, doc_setcontext},
{ "localcontext", (PyCFunction)(void(*)(void))ctxmanager_new, METH_VARARGS|METH_KEYWORDS, doc_localcontext},
{ "localcontext", _PyCFunction_CAST(ctxmanager_new), METH_VARARGS|METH_KEYWORDS, doc_localcontext},
#ifdef EXTRA_FUNCTIONALITY
{ "IEEEContext", (PyCFunction)ieee_context, METH_O, doc_ieee_context},
#endif
Expand Down
2 changes: 1 addition & 1 deletion Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4349,7 +4349,7 @@ static PyTypeObject XMLParser_Type = {
/* python module interface */

static PyMethodDef _functions[] = {
{"SubElement", (PyCFunction)(void(*)(void)) subelement, METH_VARARGS | METH_KEYWORDS},
{"SubElement", _PyCFunction_CAST(subelement), METH_VARARGS | METH_KEYWORDS},
_ELEMENTTREE__SET_FACTORIES_METHODDEF
{NULL, NULL}
};
Expand Down
2 changes: 1 addition & 1 deletion Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,7 @@ PyDoc_STRVAR(_functools_doc,

static PyMethodDef _functools_methods[] = {
{"reduce", functools_reduce, METH_VARARGS, functools_reduce_doc},
{"cmp_to_key", (PyCFunction)(void(*)(void))functools_cmp_to_key,
{"cmp_to_key", _PyCFunction_CAST(functools_cmp_to_key),
METH_VARARGS | METH_KEYWORDS, functools_cmp_to_key_doc},
{NULL, NULL} /* sentinel */
};
Expand Down
2 changes: 1 addition & 1 deletion Modules/_lsprof.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw)

static PyMethodDef profiler_methods[] = {
_LSPROF_PROFILER_GETSTATS_METHODDEF
{"enable", (PyCFunction)(void(*)(void))profiler_enable,
{"enable", _PyCFunction_CAST(profiler_enable),
METH_VARARGS | METH_KEYWORDS, enable_doc},
{"disable", (PyCFunction)profiler_disable,
METH_NOARGS, disable_doc},
Expand Down
2 changes: 1 addition & 1 deletion Modules/_operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ PyDoc_STRVAR(_operator_call__doc__,
"Same as obj(*args, **kwargs).");

#define _OPERATOR_CALL_METHODDEF \
{"call", (PyCFunction)(void(*)(void))_operator_call, METH_FASTCALL | METH_KEYWORDS, _operator_call__doc__},
{"call", _PyCFunction_CAST(_operator_call), METH_FASTCALL | METH_KEYWORDS, _operator_call__doc__},

static PyObject *
_operator_call(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
Expand Down
8 changes: 4 additions & 4 deletions Modules/_struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,8 +2049,8 @@ s_sizeof(PyStructObject *self, void *unused)

static struct PyMethodDef s_methods[] = {
STRUCT_ITER_UNPACK_METHODDEF
{"pack", (PyCFunction)(void(*)(void))s_pack, METH_FASTCALL, s_pack__doc__},
{"pack_into", (PyCFunction)(void(*)(void))s_pack_into, METH_FASTCALL, s_pack_into__doc__},
{"pack", _PyCFunction_CAST(s_pack), METH_FASTCALL, s_pack__doc__},
{"pack_into", _PyCFunction_CAST(s_pack_into), METH_FASTCALL, s_pack_into__doc__},
STRUCT_UNPACK_METHODDEF
STRUCT_UNPACK_FROM_METHODDEF
{"__sizeof__", (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__},
Expand Down Expand Up @@ -2298,8 +2298,8 @@ static struct PyMethodDef module_functions[] = {
_CLEARCACHE_METHODDEF
CALCSIZE_METHODDEF
ITER_UNPACK_METHODDEF
{"pack", (PyCFunction)(void(*)(void))pack, METH_FASTCALL, pack_doc},
{"pack_into", (PyCFunction)(void(*)(void))pack_into, METH_FASTCALL, pack_into_doc},
{"pack", _PyCFunction_CAST(pack), METH_FASTCALL, pack_doc},
{"pack_into", _PyCFunction_CAST(pack_into), METH_FASTCALL, pack_into_doc},
UNPACK_METHODDEF
UNPACK_FROM_METHODDEF
{NULL, NULL} /* sentinel */
Expand Down
Loading

0 comments on commit 804f252

Please sign in to comment.