gh-111178: fix UBSan failures in Modules/_interp*module.c (GH-129779)

Fix UBSan failures for `XIBufferViewObject`

Remove redundant casts, suppress unused return values
This commit is contained in:
Bénédikt Tran 2025-02-17 11:34:14 +01:00 committed by GitHub
parent 7ea8927ec7
commit 6669905723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 52 additions and 44 deletions

View file

@ -1934,7 +1934,7 @@ static int
module_traverse(PyObject *mod, visitproc visit, void *arg)
{
module_state *state = get_module_state(mod);
traverse_module_state(state, visit, arg);
(void)traverse_module_state(state, visit, arg);
return 0;
}
@ -1944,17 +1944,17 @@ module_clear(PyObject *mod)
module_state *state = get_module_state(mod);
// Now we clear the module state.
clear_module_state(state);
(void)clear_module_state(state);
return 0;
}
static void
module_free(void *mod)
{
module_state *state = get_module_state(mod);
module_state *state = get_module_state((PyObject *)mod);
// Now we clear the module state.
clear_module_state(state);
(void)clear_module_state(state);
_globals_fini();
}
@ -1968,7 +1968,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