]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: remove redundant casts for functions with correct signatures (#131673)
authorBénédikt Tran <10796600+picnixz@users.noreply.github.com>
Tue, 1 Apr 2025 15:18:11 +0000 (17:18 +0200)
committerGitHub <noreply@github.com>
Tue, 1 Apr 2025 15:18:11 +0000 (17:18 +0200)
30 files changed:
Modules/_asynciomodule.c
Modules/_cursesmodule.c
Modules/_functoolsmodule.c
Modules/_interpchannelsmodule.c
Modules/_io/textio.c
Modules/_io/winconsoleio.c
Modules/_lzmamodule.c
Modules/_testcapi/docstring.c
Modules/_testcapi/exceptions.c
Modules/_testcapi/gc.c
Modules/_testcapi/mem.c
Modules/_testcapi/watchers.c
Modules/_testinternalcapi.c
Modules/_xxtestfuzz/_xxtestfuzz.c
Modules/_zoneinfo.c
Modules/atexitmodule.c
Modules/cjkcodecs/cjkcodecs.h
Modules/faulthandler.c
Objects/boolobject.c
Objects/bytearrayobject.c
Objects/dictobject.c
Objects/genericaliasobject.c
Objects/listobject.c
Objects/longobject.c
Objects/object.c
Objects/rangeobject.c
Objects/stringlib/unicode_format.h
Objects/unicodeobject.c
Objects/unionobject.c
Python/hamt.c

index 28234c4f902a3415c8efaeea7a3f97b9b701ac74..d938955e8cb0e34af8a61b624ffb28d9e548b54b 100644 (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
index 2025724953969bb136f4658995d34a7a3dd1dbfd..bf18cb516050759b7e99852e0452525a268e8b49 100644 (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
index 2529a9047f329973124ffd0226a0e2e1fefd2751..c84779268eb12ef741793489c24c8b72f01a785f 100644 (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}
 };
 
index ae64037d56cac094a271fcadb3fcafec467455e4..6cc1a5b828627f81be8b65ddc6db939a8b78b70f 100644 (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
index 377c85f5ac67a67fe08f70baf879dc3742d37d07..e77d8448310fba8351db3a0e1b821cc3e6b2d40f 100644 (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
index 77fe5259e4af1e509aae00721bb1494c1bc66074..3e783b9da4565238715281b23f358afed0583545 100644 (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 */
 };
 
index 0058e2eec2ef1666c13d183fd96483b79063a64a..c05cc8a4e4cb49fa442b26783d295768675c396b 100644 (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);
index 3f7acbae1b181b207f8d00c7cf3929d082b02f6e..efb889cba8796e95c4ae5ed09ab6c1fc110938d9 100644 (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"
index b647bfc71eae2445a46d56cb863265d79a7e563e..0604b413e33f61c2d4a4c6e96ad36ab592d5f6c3 100644 (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[] = {
index 3691796302e5001702ebd4db037029976e923862..863cb52980f9425205453321f885d4f1b7bc10a6 100644 (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}
 };
 
index 7237fb94c3f51f4aae4b3101608b56c3a857b89c..b4896f984510bd6e774d0ac56748fa4197f23838 100644 (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},
index 6a5136ef8c9ecc32099ecb5954a028705f821a71..6d061bb8d510408d0500da31bbcc44fa66172776 100644 (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},
 };
 
index 56e3408652a6a07b799f8a99e056249988efea2d..1858ce2b00c8243f66e6dc7c7812ec0019da0751 100644 (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,
 };
 
 
index 2952d7043e01fec88b6b1c56a6097fb45c65872f..0e0ca5f95fa449ff4b9713e1fceb4a7033e8b8d3 100644 (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},
 };
 
index b736b7e04986d58a2317b9f03eb4b285c6a2f1fa..abd53436b21b2995066ffbf723e81c1039714f1a 100644 (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),
index 2bfdda53af8cb23dfb1e189e9c4d0a00e7bc7ec0..4b068967a6ca6ea1408bf0f54408d638d61803b5 100644 (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 */
 };
index 737a7a042753a9f9f22f408d7a0601264a9113bd..f66412237011d4252de9985af5e5022de8c2ba62 100644 (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},
 };
 
index ba7970d66565e56231face32171628986ff889e0..cc5ecdcc4f96e95d68c617cfc101d9093917568a 100644 (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
index a88a8ad0cfd560d1c0aee5748af078c36aa6df60..b694691ae4d0d1e02754ba44fde9d6e96f9544cd 100644 (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 */
index 8f2d2dd02151c14e0646eb58662d082d660e5c78..b5d5ca9178ebdba9c949f2097eebeb6c021f2431 100644 (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 */
index a290eae6464e0724d853f42c07598e549d381d32..ab18772d144bba966abe98c133fc5f1c543d3c56 100644 (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));
index a56ed908d711331962bbe58825af24975ae1afda..ec3d01f00a3c3c261e4357d02f85da21623055bd 100644 (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),
 };
 
index 917bef1a66ddffb9d26d6751c74eb20e4fc1d28a..12d5b33414a92af29c20ee3a64a0327ae049e996 100644 (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 */
index d0c3bb145ac28d6f831c86777875b1de0aad28be..692312c1ad976cb695cd7b7e14f6a65f3e77eff9 100644 (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 */
index 974cf609cfccb485ed854c421140a2ac00a29f25..457ff17b980e75aefa55a416bf9735d243e8b5b8 100644 (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 */
index d5cc2b09427dee7bad027a0fdff48f4d3172fab0..24f9ce807fd24e8060c8726ef12a4fc7219b16d7 100644 (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
index 982fc5184a5b2adec20333440dcf2258834fa4f8..ff32db65b11a0b1ea5c4bbeac3905706cb108bc4 100644 (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;
index 3e0bd90c17995f6c20dae40f009a7151adeae5af..7c735685e89389298a3cd2aed55997a030e67810 100644 (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}
 };
index 08422662e8118a97ca63083621577023e8deef99..0b7d4c72bffb978b7bf48d2f78eba5e769c3300a 100644 (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}
 };
index 42a0baffd9def95c81ccd9dca81eaf66aeb65b90..e4d1e1663dd573dc25ddf8b27d0a84533769e6c2 100644 (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