gh-111178: fix UBSan failures in `Modules/_interp*module.c` by picnixz · Pull Request #129779 · python/cpython · GitHub
Skip to content
Merged
62 changes: 33 additions & 29 deletions Modules/_interpchannelsmodule.c
10 changes: 5 additions & 5 deletions Modules/_interpqueuesmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
}
Expand All @@ -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
Expand Down
24 changes: 14 additions & 10 deletions Modules/_interpretersmodule.c