Skip to content

_remote_debugging/module.c defines Py_MOD_GIL_NOT_USED twice #151584

Closed

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

Activity

  1. self-assigned this
    on Jun 17, 2026
  2. added
    type-refactorCode refactoring (with no changes in behavior)
    and removed
    type-bugAn unexpected behavior, bug, or error
    on Jun 17, 2026
  3. added 2 commits that reference this issue on Jun 17, 2026
  4. added a commit that references this issue on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-refactorCode refactoring (with no changes in behavior)

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions