gh-111178: remove redundant casts for functions with correct signatures (#131673)

This commit is contained in:
Bénédikt Tran 2025-04-01 17:18:11 +02:00 committed by GitHub
parent 8cd29c2b53
commit edbf7fb129
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 96 additions and 101 deletions

View file

@ -2956,7 +2956,7 @@ static PyType_Slot Task_slots[] = {
{Py_tp_iter, future_new_iter},
{Py_tp_methods, TaskType_methods},
{Py_tp_getset, TaskType_getsetlist},
{Py_tp_init, (initproc)_asyncio_Task___init__},
{Py_tp_init, _asyncio_Task___init__},
{Py_tp_new, PyType_GenericNew},
{Py_tp_finalize, TaskObj_finalize},
@ -4396,7 +4396,7 @@ static struct PyModuleDef _asynciomodule = {
.m_slots = module_slots,
.m_traverse = module_traverse,
.m_clear = module_clear,
.m_free = (freefunc)module_free,
.m_free = module_free,
};
PyMODINIT_FUNC

View file

@ -2709,7 +2709,7 @@ static PyMethodDef PyCursesWindow_methods[] = {
_CURSES_WINDOW_SETSCRREG_METHODDEF
{"standend", PyCursesWindow_wstandend, METH_NOARGS},
{"standout", PyCursesWindow_wstandout, METH_NOARGS},
{"subpad", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
{"subpad", _curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
_CURSES_WINDOW_SUBWIN_METHODDEF
{"syncdown", PyCursesWindow_wsyncdown, METH_NOARGS},
#ifdef HAVE_CURSES_SYNCOK

View file

@ -1634,19 +1634,19 @@ _functools__lru_cache_wrapper_cache_clear_impl(PyObject *self)
}
static PyObject *
lru_cache_reduce(PyObject *self, PyObject *unused)
lru_cache_reduce(PyObject *self, PyObject *Py_UNUSED(dummy))
{
return PyObject_GetAttrString(self, "__qualname__");
}
static PyObject *
lru_cache_copy(PyObject *self, PyObject *unused)
lru_cache_copy(PyObject *self, PyObject *Py_UNUSED(args))
{
return Py_NewRef(self);
}
static PyObject *
lru_cache_deepcopy(PyObject *self, PyObject *unused)
lru_cache_deepcopy(PyObject *self, PyObject *Py_UNUSED(args))
{
return Py_NewRef(self);
}
@ -1693,9 +1693,9 @@ cache_info_type: namedtuple class with the fields:\n\
static PyMethodDef lru_cache_methods[] = {
_FUNCTOOLS__LRU_CACHE_WRAPPER_CACHE_INFO_METHODDEF
_FUNCTOOLS__LRU_CACHE_WRAPPER_CACHE_CLEAR_METHODDEF
{"__reduce__", (PyCFunction)lru_cache_reduce, METH_NOARGS},
{"__copy__", (PyCFunction)lru_cache_copy, METH_VARARGS},
{"__deepcopy__", (PyCFunction)lru_cache_deepcopy, METH_VARARGS},
{"__reduce__", lru_cache_reduce, METH_NOARGS},
{"__copy__", lru_cache_copy, METH_VARARGS},
{"__deepcopy__", lru_cache_deepcopy, METH_VARARGS},
{NULL}
};

View file

@ -3595,7 +3595,7 @@ static struct PyModuleDef moduledef = {
.m_slots = module_slots,
.m_traverse = module_traverse,
.m_clear = module_clear,
.m_free = (freefunc)module_free,
.m_free = module_free,
};
PyMODINIT_FUNC

View file

@ -3386,8 +3386,6 @@ static PyMemberDef textiowrapper_members[] = {
static PyGetSetDef textiowrapper_getset[] = {
_IO_TEXTIOWRAPPER_NAME_GETSETDEF
_IO_TEXTIOWRAPPER_CLOSED_GETSETDEF
/* {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL},
*/
_IO_TEXTIOWRAPPER_NEWLINES_GETSETDEF
_IO_TEXTIOWRAPPER_ERRORS_GETSETDEF
_IO_TEXTIOWRAPPER__CHUNK_SIZE_GETSETDEF

View file

@ -1195,7 +1195,7 @@ static PyMethodDef winconsoleio_methods[] = {
_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
{"_isatty_open_only", (PyCFunction)_io__WindowsConsoleIO_isatty, METH_NOARGS},
{"_isatty_open_only", _io__WindowsConsoleIO_isatty, METH_NOARGS},
{NULL, NULL} /* sentinel */
};

View file

@ -1410,7 +1410,7 @@ PyDoc_STRVAR(_lzma__encode_filter_properties__doc__,
"The result does not include the filter ID itself, only the options.");
#define _LZMA__ENCODE_FILTER_PROPERTIES_METHODDEF \
{"_encode_filter_properties", (PyCFunction)_lzma__encode_filter_properties, METH_O, _lzma__encode_filter_properties__doc__},
{"_encode_filter_properties", _lzma__encode_filter_properties, METH_O, _lzma__encode_filter_properties__doc__},
static PyObject *
_lzma__encode_filter_properties_impl(PyObject *module, lzma_filter filter);

View file

@ -66,42 +66,42 @@ test_with_docstring(PyObject *self, PyObject *Py_UNUSED(ignored))
static PyMethodDef test_methods[] = {
{"docstring_empty",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_empty},
{"docstring_no_signature",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_no_signature},
{"docstring_no_signature_noargs",
(PyCFunction)test_with_docstring, METH_NOARGS,
test_with_docstring, METH_NOARGS,
docstring_no_signature},
{"docstring_no_signature_o",
(PyCFunction)test_with_docstring, METH_O,
test_with_docstring, METH_O,
docstring_no_signature},
{"docstring_with_invalid_signature",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_invalid_signature},
{"docstring_with_invalid_signature2",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_invalid_signature2},
{"docstring_with_signature",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_signature},
{"docstring_with_signature_and_extra_newlines",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_signature_and_extra_newlines},
{"docstring_with_signature_but_no_doc",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_signature_but_no_doc},
{"docstring_with_signature_with_defaults",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
docstring_with_signature_with_defaults},
{"no_docstring",
(PyCFunction)test_with_docstring, METH_VARARGS},
test_with_docstring, METH_VARARGS},
{"test_with_docstring",
test_with_docstring, METH_VARARGS,
PyDoc_STR("This is a pretty normal docstring.")},
{"func_with_unrepresentable_signature",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
PyDoc_STR(
"func_with_unrepresentable_signature($module, /, a, b=<x>)\n"
"--\n\n"
@ -112,28 +112,28 @@ static PyMethodDef test_methods[] = {
static PyMethodDef DocStringNoSignatureTest_methods[] = {
{"meth_noargs",
(PyCFunction)test_with_docstring, METH_NOARGS,
test_with_docstring, METH_NOARGS,
docstring_no_signature},
{"meth_o",
(PyCFunction)test_with_docstring, METH_O,
test_with_docstring, METH_O,
docstring_no_signature},
{"meth_noargs_class",
(PyCFunction)test_with_docstring, METH_NOARGS|METH_CLASS,
test_with_docstring, METH_NOARGS|METH_CLASS,
docstring_no_signature},
{"meth_o_class",
(PyCFunction)test_with_docstring, METH_O|METH_CLASS,
test_with_docstring, METH_O|METH_CLASS,
docstring_no_signature},
{"meth_noargs_static",
(PyCFunction)test_with_docstring, METH_NOARGS|METH_STATIC,
test_with_docstring, METH_NOARGS|METH_STATIC,
docstring_no_signature},
{"meth_o_static",
(PyCFunction)test_with_docstring, METH_O|METH_STATIC,
test_with_docstring, METH_O|METH_STATIC,
docstring_no_signature},
{"meth_noargs_coexist",
(PyCFunction)test_with_docstring, METH_NOARGS|METH_COEXIST,
test_with_docstring, METH_NOARGS|METH_COEXIST,
docstring_no_signature},
{"meth_o_coexist",
(PyCFunction)test_with_docstring, METH_O|METH_COEXIST,
test_with_docstring, METH_O|METH_COEXIST,
docstring_no_signature},
{NULL},
};
@ -149,28 +149,28 @@ static PyTypeObject DocStringNoSignatureTest = {
static PyMethodDef DocStringUnrepresentableSignatureTest_methods[] = {
{"meth",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
PyDoc_STR(
"meth($self, /, a, b=<x>)\n"
"--\n\n"
"This docstring has a signature with unrepresentable default."
)},
{"classmeth",
(PyCFunction)test_with_docstring, METH_VARARGS|METH_CLASS,
test_with_docstring, METH_VARARGS|METH_CLASS,
PyDoc_STR(
"classmeth($type, /, a, b=<x>)\n"
"--\n\n"
"This docstring has a signature with unrepresentable default."
)},
{"staticmeth",
(PyCFunction)test_with_docstring, METH_VARARGS|METH_STATIC,
test_with_docstring, METH_VARARGS|METH_STATIC,
PyDoc_STR(
"staticmeth(a, b=<x>)\n"
"--\n\n"
"This docstring has a signature with unrepresentable default."
)},
{"with_default",
(PyCFunction)test_with_docstring, METH_VARARGS,
test_with_docstring, METH_VARARGS,
PyDoc_STR(
"with_default($self, /, x=ONE)\n"
"--\n\n"

View file

@ -538,7 +538,7 @@ static PyTypeObject PyRecursingInfinitelyError_Type = {
.tp_basicsize = sizeof(PyBaseExceptionObject),
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
.tp_doc = PyDoc_STR("Instantiating this exception starts infinite recursion."),
.tp_init = (initproc)recurse_infinitely_error_init,
.tp_init = recurse_infinitely_error_init,
};
static PyMethodDef test_methods[] = {

View file

@ -265,7 +265,7 @@ obj_extra_data_set(PyObject *self, PyObject *newval, void *Py_UNUSED(ignored))
}
static PyGetSetDef obj_extra_data_getset[] = {
{"extra", (getter)obj_extra_data_get, (setter)obj_extra_data_set, NULL},
{"extra", obj_extra_data_get, obj_extra_data_set, NULL},
{NULL}
};

View file

@ -691,7 +691,7 @@ static PyMethodDef test_methods[] = {
{"pyobject_malloc_without_gil", pyobject_malloc_without_gil, METH_NOARGS},
{"remove_mem_hooks", remove_mem_hooks, METH_NOARGS,
PyDoc_STR("Remove memory hooks.")},
{"set_nomemory", (PyCFunction)set_nomemory, METH_VARARGS,
{"set_nomemory", set_nomemory, METH_VARARGS,
PyDoc_STR("set_nomemory(start:int, stop:int = 0)")},
{"test_pymem_alloc0", test_pymem_alloc0, METH_NOARGS},
{"test_pymem_setallocators", test_pymem_setallocators, METH_NOARGS},

View file

@ -413,7 +413,7 @@ get_code_watcher_num_destroyed_events(PyObject *self, PyObject *watcher_id)
}
static PyObject *
allocate_too_many_code_watchers(PyObject *self, PyObject *args)
allocate_too_many_code_watchers(PyObject *self, PyObject *Py_UNUSED(args))
{
int watcher_ids[CODE_MAX_WATCHERS + 1];
int num_watchers = 0;
@ -742,7 +742,7 @@ get_context_switches(PyObject *Py_UNUSED(self), PyObject *watcher_id)
}
static PyObject *
allocate_too_many_context_watchers(PyObject *self, PyObject *args)
allocate_too_many_context_watchers(PyObject *self, PyObject *Py_UNUSED(args))
{
int watcher_ids[CONTEXT_MAX_WATCHERS + 1];
int num_watchers = 0;
@ -811,8 +811,7 @@ static PyMethodDef test_methods[] = {
{"clear_dict_watcher", clear_dict_watcher, METH_O, NULL},
_TESTCAPI_WATCH_DICT_METHODDEF
_TESTCAPI_UNWATCH_DICT_METHODDEF
{"get_dict_watcher_events",
(PyCFunction) get_dict_watcher_events, METH_NOARGS, NULL},
{"get_dict_watcher_events", get_dict_watcher_events, METH_NOARGS, NULL},
// Type watchers.
{"add_type_watcher", add_type_watcher, METH_O, NULL},
@ -820,7 +819,7 @@ static PyMethodDef test_methods[] = {
_TESTCAPI_WATCH_TYPE_METHODDEF
_TESTCAPI_UNWATCH_TYPE_METHODDEF
{"get_type_modified_events",
(PyCFunction) get_type_modified_events, METH_NOARGS, NULL},
get_type_modified_events, METH_NOARGS, NULL},
// Code object watchers.
{"add_code_watcher", add_code_watcher, METH_O, NULL},
@ -830,7 +829,7 @@ static PyMethodDef test_methods[] = {
{"get_code_watcher_num_destroyed_events",
get_code_watcher_num_destroyed_events, METH_O, NULL},
{"allocate_too_many_code_watchers",
(PyCFunction) allocate_too_many_code_watchers, METH_NOARGS, NULL},
allocate_too_many_code_watchers, METH_NOARGS, NULL},
// Function watchers.
{"add_func_watcher", add_func_watcher, METH_O, NULL},
@ -846,7 +845,7 @@ static PyMethodDef test_methods[] = {
{"clear_context_stack", clear_context_stack, METH_NOARGS, NULL},
{"get_context_switches", get_context_switches, METH_O, NULL},
{"allocate_too_many_context_watchers",
(PyCFunction) allocate_too_many_context_watchers, METH_NOARGS, NULL},
allocate_too_many_context_watchers, METH_NOARGS, NULL},
{NULL},
};

View file

@ -2212,7 +2212,7 @@ static struct PyModuleDef _testcapimodule = {
.m_slots = module_slots,
.m_traverse = module_traverse,
.m_clear = module_clear,
.m_free = (freefunc)module_free,
.m_free = module_free,
};

View file

@ -24,7 +24,7 @@ static PyObject* _fuzz_run(PyObject* self, PyObject* args) {
}
static PyMethodDef module_methods[] = {
{"run", (PyCFunction)_fuzz_run, METH_VARARGS, ""},
{"run", _fuzz_run, METH_VARARGS, ""},
{NULL},
};

View file

@ -2605,10 +2605,10 @@ static PyMethodDef zoneinfo_methods[] = {
ZONEINFO_ZONEINFO_UTCOFFSET_METHODDEF
ZONEINFO_ZONEINFO_DST_METHODDEF
ZONEINFO_ZONEINFO_TZNAME_METHODDEF
{"fromutc", (PyCFunction)zoneinfo_fromutc, METH_O,
{"fromutc", zoneinfo_fromutc, METH_O,
PyDoc_STR("Given a datetime with local time in UTC, retrieve an adjusted "
"datetime in local time.")},
{"__reduce__", (PyCFunction)zoneinfo_reduce, METH_NOARGS,
{"__reduce__", zoneinfo_reduce, METH_NOARGS,
PyDoc_STR("Function for serialization with the pickle protocol.")},
ZONEINFO_ZONEINFO__UNPICKLE_METHODDEF
{"__init_subclass__", _PyCFunction_CAST(zoneinfo_init_subclass),

View file

@ -217,7 +217,7 @@ Run all registered exit functions.\n\
If a callback raises an exception, it is logged with sys.unraisablehook.");
static PyObject *
atexit_run_exitfuncs(PyObject *module, PyObject *unused)
atexit_run_exitfuncs(PyObject *module, PyObject *Py_UNUSED(dummy))
{
struct atexit_state *state = get_atexit_state();
atexit_callfuncs(state);
@ -231,7 +231,7 @@ PyDoc_STRVAR(atexit_clear__doc__,
Clear the list of previously registered exit functions.");
static PyObject *
atexit_clear(PyObject *module, PyObject *unused)
atexit_clear(PyObject *module, PyObject *Py_UNUSED(dummy))
{
atexit_cleanup(get_atexit_state());
Py_RETURN_NONE;
@ -244,7 +244,7 @@ PyDoc_STRVAR(atexit_ncallbacks__doc__,
Return the number of registered exit functions.");
static PyObject *
atexit_ncallbacks(PyObject *module, PyObject *unused)
atexit_ncallbacks(PyObject *module, PyObject *Py_UNUSED(dummy))
{
struct atexit_state *state = get_atexit_state();
assert(state->callbacks != NULL);
@ -300,13 +300,11 @@ atexit_unregister(PyObject *module, PyObject *func)
static PyMethodDef atexit_methods[] = {
{"register", _PyCFunction_CAST(atexit_register), METH_VARARGS|METH_KEYWORDS,
atexit_register__doc__},
{"_clear", (PyCFunction) atexit_clear, METH_NOARGS,
atexit_clear__doc__},
{"unregister", (PyCFunction) atexit_unregister, METH_O,
atexit_unregister__doc__},
{"_run_exitfuncs", (PyCFunction) atexit_run_exitfuncs, METH_NOARGS,
{"_clear", atexit_clear, METH_NOARGS, atexit_clear__doc__},
{"unregister", atexit_unregister, METH_O, atexit_unregister__doc__},
{"_run_exitfuncs", atexit_run_exitfuncs, METH_NOARGS,
atexit_run_exitfuncs__doc__},
{"_ncallbacks", (PyCFunction) atexit_ncallbacks, METH_NOARGS,
{"_ncallbacks", atexit_ncallbacks, METH_NOARGS,
atexit_ncallbacks__doc__},
{NULL, NULL} /* sentinel */
};

View file

@ -495,7 +495,7 @@ _cjk_free(void *mod)
}
static struct PyMethodDef _cjk_methods[] = {
{"getcodec", (PyCFunction)getcodec, METH_O, ""},
{"getcodec", getcodec, METH_O, ""},
{NULL, NULL},
};

View file

@ -1108,7 +1108,7 @@ faulthandler_fatal_error_c_thread(PyObject *self, PyObject *args)
}
static PyObject* _Py_NO_SANITIZE_UNDEFINED
faulthandler_sigfpe(PyObject *self, PyObject *args)
faulthandler_sigfpe(PyObject *self, PyObject *Py_UNUSED(dummy))
{
faulthandler_suppress_crash_report();
@ -1274,7 +1274,7 @@ static PyMethodDef module_methods[] = {
{"_sigabrt", faulthandler_sigabrt, METH_NOARGS,
PyDoc_STR("_sigabrt($module, /)\n--\n\n"
"Raise a SIGABRT signal.")},
{"_sigfpe", (PyCFunction)faulthandler_sigfpe, METH_NOARGS,
{"_sigfpe", faulthandler_sigfpe, METH_NOARGS,
PyDoc_STR("_sigfpe($module, /)\n--\n\n"
"Raise a SIGFPE signal.")},
#ifdef FAULTHANDLER_STACK_OVERFLOW

View file

@ -130,7 +130,7 @@ static PyNumberMethods bool_as_number = {
0, /* nb_positive */
0, /* nb_absolute */
0, /* nb_bool */
(unaryfunc)bool_invert, /* nb_invert */
bool_invert, /* nb_invert */
0, /* nb_lshift */
0, /* nb_rshift */
bool_and, /* nb_and */

View file

@ -2832,7 +2832,7 @@ PyTypeObject PyByteArray_Type = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)bytearray___init__, /* tp_init */
bytearray___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
PyObject_Free, /* tp_free */

View file

@ -5927,7 +5927,7 @@ dictview_mapping(PyObject *view, void *Py_UNUSED(ignored)) {
}
static PyGetSetDef dictview_getset[] = {
{"mapping", dictview_mapping, (setter)NULL,
{"mapping", dictview_mapping, NULL,
PyDoc_STR("dictionary that this view refers to"), NULL},
{0}
};
@ -6344,7 +6344,7 @@ dictviews_xor(PyObject* self, PyObject *other)
static PyNumberMethods dictviews_as_number = {
0, /*nb_add*/
(binaryfunc)dictviews_sub, /*nb_subtract*/
dictviews_sub, /*nb_subtract*/
0, /*nb_multiply*/
0, /*nb_remainder*/
0, /*nb_divmod*/
@ -6356,9 +6356,9 @@ static PyNumberMethods dictviews_as_number = {
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
(binaryfunc)_PyDictView_Intersect, /*nb_and*/
(binaryfunc)dictviews_xor, /*nb_xor*/
(binaryfunc)dictviews_or, /*nb_or*/
_PyDictView_Intersect, /*nb_and*/
dictviews_xor, /*nb_xor*/
dictviews_or, /*nb_or*/
};
static PyObject*
@ -6616,7 +6616,7 @@ static PySequenceMethods dictvalues_as_sequence = {
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
(objobjproc)0, /* sq_contains */
0, /* sq_contains */
};
static PyObject* dictvalues_reversed(PyObject *dv, PyObject *Py_UNUSED(ignored));

View file

@ -824,8 +824,8 @@ ga_unpacked_tuple_args(PyObject *self, void *unused)
}
static PyGetSetDef ga_properties[] = {
{"__parameters__", ga_parameters, (setter)NULL, PyDoc_STR("Type variables in the GenericAlias."), NULL},
{"__typing_unpacked_tuple_args__", ga_unpacked_tuple_args, (setter)NULL, NULL},
{"__parameters__", ga_parameters, NULL, PyDoc_STR("Type variables in the GenericAlias."), NULL},
{"__typing_unpacked_tuple_args__", ga_unpacked_tuple_args, NULL, NULL},
{0}
};
@ -1000,7 +1000,7 @@ PyTypeObject Py_GenericAliasType = {
.tp_new = ga_new,
.tp_free = PyObject_GC_Del,
.tp_getset = ga_properties,
.tp_iter = (getiterfunc)ga_iter,
.tp_iter = ga_iter,
.tp_vectorcall_offset = offsetof(gaobject, vectorcall),
};

View file

@ -3873,7 +3873,7 @@ PyTypeObject PyList_Type = {
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)list___init__, /* tp_init */
list___init__, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
PyObject_GC_Del, /* tp_free */

View file

@ -6540,19 +6540,19 @@ static PyMethodDef long_methods[] = {
static PyGetSetDef long_getset[] = {
{"real",
long_long_getter, (setter)NULL,
long_long_getter, NULL,
"the real part of a complex number",
NULL},
{"imag",
long_get0, (setter)NULL,
long_get0, NULL,
"the imaginary part of a complex number",
NULL},
{"numerator",
long_long_getter, (setter)NULL,
long_long_getter, NULL,
"the numerator of a rational number in lowest terms",
NULL},
{"denominator",
long_get1, (setter)NULL,
long_get1, NULL,
"the denominator of a rational number in lowest terms",
NULL},
{NULL} /* Sentinel */

View file

@ -2106,7 +2106,7 @@ static PyNumberMethods none_as_number = {
0, /* nb_negative */
0, /* nb_positive */
0, /* nb_absolute */
(inquiry)none_bool, /* nb_bool */
none_bool, /* nb_bool */
0, /* nb_invert */
0, /* nb_lshift */
0, /* nb_rshift */
@ -2152,7 +2152,7 @@ PyTypeObject _PyNone_Type = {
&none_as_number, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
(hashfunc)none_hash,/*tp_hash */
none_hash, /*tp_hash */
0, /*tp_call */
0, /*tp_str */
0, /*tp_getattro */

View file

@ -733,7 +733,7 @@ range_subscript(PyObject *op, PyObject *item)
static PyMappingMethods range_as_mapping = {
range_length, /* mp_length */
range_subscript, /* mp_subscript */
(objobjargproc)0, /* mp_ass_subscript */
0, /* mp_ass_subscript */
};
static int

View file

@ -1100,7 +1100,7 @@ static PyTypeObject PyFormatterIter_Type = {
describing the parsed elements. It's a wrapper around
stringlib/string_format.h's MarkupIterator */
static PyObject *
formatter_parser(PyObject *ignored, PyObject *self)
formatter_parser(PyObject *Py_UNUSED(module), PyObject *self)
{
formatteriterobject *it;
@ -1236,7 +1236,7 @@ static PyTypeObject PyFieldNameIter_Type = {
field_name_split. The iterator it returns is a
FieldNameIterator */
static PyObject *
formatter_field_name_split(PyObject *ignored, PyObject *self)
formatter_field_name_split(PyObject *Py_UNUSED(module), PyObject *self)
{
SubString first;
Py_ssize_t first_idx;

View file

@ -14316,7 +14316,7 @@ static PyMethodDef unicode_methods[] = {
UNICODE_ISPRINTABLE_METHODDEF
UNICODE_ZFILL_METHODDEF
{"format", _PyCFunction_CAST(do_string_format), METH_VARARGS | METH_KEYWORDS, format__doc__},
{"format_map", (PyCFunction) do_string_format_map, METH_O, format_map__doc__},
{"format_map", do_string_format_map, METH_O, format_map__doc__},
UNICODE___FORMAT___METHODDEF
UNICODE_MAKETRANS_METHODDEF
UNICODE_SIZEOF_METHODDEF
@ -14340,14 +14340,14 @@ static PyNumberMethods unicode_as_number = {
};
static PySequenceMethods unicode_as_sequence = {
(lenfunc) unicode_length, /* sq_length */
PyUnicode_Concat, /* sq_concat */
(ssizeargfunc) unicode_repeat, /* sq_repeat */
(ssizeargfunc) unicode_getitem, /* sq_item */
unicode_length, /* sq_length */
PyUnicode_Concat, /* sq_concat */
unicode_repeat, /* sq_repeat */
unicode_getitem, /* sq_item */
0, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
PyUnicode_Contains, /* sq_contains */
PyUnicode_Contains, /* sq_contains */
};
static PyObject*
@ -14421,9 +14421,9 @@ unicode_subscript(PyObject* self, PyObject* item)
}
static PyMappingMethods unicode_as_mapping = {
(lenfunc)unicode_length, /* mp_length */
(binaryfunc)unicode_subscript, /* mp_subscript */
(objobjargproc)0, /* mp_ass_subscript */
unicode_length, /* mp_length */
unicode_subscript, /* mp_subscript */
0, /* mp_ass_subscript */
};
@ -15566,7 +15566,7 @@ PyTypeObject PyUnicode_Type = {
sizeof(PyUnicodeObject), /* tp_basicsize */
0, /* tp_itemsize */
/* Slots */
(destructor)unicode_dealloc, /* tp_dealloc */
unicode_dealloc, /* tp_dealloc */
0, /* tp_vectorcall_offset */
0, /* tp_getattr */
0, /* tp_setattr */
@ -15575,9 +15575,9 @@ PyTypeObject PyUnicode_Type = {
&unicode_as_number, /* tp_as_number */
&unicode_as_sequence, /* tp_as_sequence */
&unicode_as_mapping, /* tp_as_mapping */
(hashfunc) unicode_hash, /* tp_hash*/
unicode_hash, /* tp_hash*/
0, /* tp_call*/
(reprfunc) unicode_str, /* tp_str */
unicode_str, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
@ -16474,9 +16474,9 @@ _PyUnicode_Fini(PyInterpreterState *interp)
to the string.Formatter class implemented in Python. */
static PyMethodDef _string_methods[] = {
{"formatter_field_name_split", (PyCFunction) formatter_field_name_split,
{"formatter_field_name_split", formatter_field_name_split,
METH_O, PyDoc_STR("split the argument as a field name")},
{"formatter_parser", (PyCFunction) formatter_parser,
{"formatter_parser", formatter_parser,
METH_O, PyDoc_STR("parse the argument as a format string")},
{NULL, NULL}
};

View file

@ -380,7 +380,7 @@ static PyGetSetDef union_properties[] = {
PyDoc_STR("Qualified name of the type"), NULL},
{"__origin__", union_origin, NULL,
PyDoc_STR("Always returns the type"), NULL},
{"__parameters__", union_parameters, (setter)NULL,
{"__parameters__", union_parameters, NULL,
PyDoc_STR("Type variables in the types.UnionType."), NULL},
{0}
};

View file

@ -2516,7 +2516,7 @@ hamt_baseiter_new(PyTypeObject *type, binaryfunc yield, PyHamtObject *o)
.tp_traverse = hamt_baseiter_tp_traverse, \
.tp_clear = hamt_baseiter_tp_clear, \
.tp_iter = PyObject_SelfIter, \
.tp_iternext = (iternextfunc)hamt_baseiter_tp_iternext,
.tp_iternext = hamt_baseiter_tp_iternext,
/////////////////////////////////// _PyHamtItems_Type