Skip to content

TypedPython: a compiled module re-enables the GIL on a free-threaded build #159

Closed

Description

@b-re-w

tp_runtime.h declares no Py_mod_gil slot, so importing any compiled module into 3.14t makes CPython re-enable the GIL for the whole process (its own comment says so: tp_globals_epoch and class caches rely on GIL serialisation). Parallelism (AGENTS §12.8, #151) silently disappears.

Work: make the runtime safe without the GIL (atomic epoch, per-module state, Py_BEGIN_CRITICAL_SECTION around array copy-in and write-back; decide #152 together), then declare Py_MOD_GIL_NOT_USED.
Completion: a test that fails today: on desktop 3.14t, import a compiled module and assert sys._is_gil_enabled() is False; plus the existing suite green on 3.14t. Depends on the decision in the free-threaded readiness issue.

Activity

  1. b-re-w commented on Oct 3, 2026

    @b-re-w
    MemberAuthor

    Scope added (leader decision, 2026-10-04):

  2. added a commit that references this issue on Oct 17, 2026
  3. b-re-w commented on Oct 17, 2026

    @b-re-w
    MemberAuthor

    Landed in develop via #209.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions