-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
traverse_module_state can in theory return non-zero code:
cpython/Modules/_interpchannelsmodule.c
Lines 283 to 302 in 0d9d489
| 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:
Lines 193 to 200 in 0d9d489
| #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:
cpython/Modules/_interpchannelsmodule.c
Lines 3627 to 3629 in 0d9d489
| // 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
- gh-135839: Fix
traverse_module_stateusage in_interpchannelsmodule#135840 - [3.14] gh-135839: Fix
module_traverseandmodule_clearin_interpchannelsmodule(GH-135840) #135918 - [3.13] gh-135839: Fix
module_traverseandmodule_clearin_interpchannelsmodule(GH-135840) #135919 - gh-135839: Fix
module_traverseandmodule_clearin subinterp modules #135937 - [3.14] gh-135839: Fix
module_traverseandmodule_clearin subinterp modules (GH-135937) #135939 - [3.13] gh-135839: Fix
module_traverseandmodule_clearin subinterp modules (GH-135937) #135943
Metadata
Metadata
Assignees
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Done