Bug report
traverse_module_state can in theory return non-zero code:
|
static int |
|
traverse_module_state(module_state *state, visitproc visit, void *arg) |
|
{ |
|
/* external types */ |
|
Py_VISIT(state->send_channel_type); |
|
Py_VISIT(state->recv_channel_type); |
|
|
|
/* heap types */ |
|
Py_VISIT(state->ChannelInfoType); |
|
Py_VISIT(state->ChannelIDType); |
|
|
|
/* exceptions */ |
|
Py_VISIT(state->ChannelError); |
|
Py_VISIT(state->ChannelNotFoundError); |
|
Py_VISIT(state->ChannelClosedError); |
|
Py_VISIT(state->ChannelEmptyError); |
|
Py_VISIT(state->ChannelNotEmptyError); |
|
|
|
return 0; |
|
} |
because PY_VISIT can return it:
|
#define Py_VISIT(op) \ |
|
do { \ |
|
if (op) { \ |
|
int vret = visit(_PyObject_CAST(op), arg); \ |
|
if (vret) \ |
|
return vret; \ |
|
} \ |
|
} while (0) |
So, using it like this:
|
// Now we clear the module state. |
|
(void)clear_module_state(state); |
|
return 0; |
Is also not really correct. I will send a PR with the fix.
Linked PRs
Bug report
traverse_module_statecan in theory return non-zero code:cpython/Modules/_interpchannelsmodule.c
Lines 283 to 302 in 0d9d489
because
PY_VISITcan return it:cpython/Include/objimpl.h
Lines 193 to 200 in 0d9d489
So, using it like this:
cpython/Modules/_interpchannelsmodule.c
Lines 3627 to 3629 in 0d9d489
Is also not really correct. I will send a PR with the fix.
Linked PRs
traverse_module_stateusage in_interpchannelsmodule#135840module_traverseandmodule_clearin_interpchannelsmodule(GH-135840) #135918module_traverseandmodule_clearin_interpchannelsmodule(GH-135840) #135919module_traverseandmodule_clearin subinterp modules #135937module_traverseandmodule_clearin subinterp modules (GH-135937) #135939module_traverseandmodule_clearin subinterp modules (GH-135937) #135943