Skip to content

_remote_debugging/module.c defines Py_MOD_GIL_NOT_USED twice #151584

@sobolevn

Description

@sobolevn

Bug report

It uses two definitions of Py_MOD_GIL_NOT_USED. First one in the slots (as it should be):

static PyModuleDef_Slot remote_debugging_slots[] = {
_Py_ABI_SLOT,
{Py_mod_exec, _remote_debugging_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
{0, NULL},
};

Second one in _remote_debugging_exec:

#ifdef Py_GIL_DISABLED
PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);
#endif

These two ways set the same requires_gil field in the module struct: ((PyModuleObject *)module)->md_requires_gil = requires_gil;, so there's no need to duplicate this. PyUnstable_Module_SetGIL is used for single-phase-initialization modules.

I will send a PR removing the PyUnstable_Module_SetGIL call.

Linked PRs

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-refactorCode refactoring (with no changes in behavior)
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions