GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow C extensions to declare compatibility with free-threading · Issue #116322 · python/cpython

Allow C extensions to declare compatibility with free-threading #116322

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow C extensions to declare compatibility with free-threading#116322
Copy link
Assignees
swtaarrs
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Description

@swtaarrs
swtaarrs
opened on Mar 4, 2024
Issue body actions

Feature or enhancement

There are a few pieces to this:

  1. Add a Py_mod_gil slot, as described in PEP 703, that multi-phase init modules can use to indicate that they support free-threading.
  2. Add a PyModule_ExperimentalSetGIL() function (discussed here) that single-phase init modules can use in place of Py_mod_gil.
  3. Mark all built-in modules as free-threading compatible with one of the above mechanisms.
  4. Enable the GIL while loading a C module and leave it permanently enabled if the module does not declare free-threading compatibility.

1-3 are addressed in gh-116882; 4 will be addressed in a separate PR.

Linked PRs

  • gh-116322: Add Py_mod_gil module slot #116882
  • gh-116322: Enable the GIL while loading C extension modules #118560
  • gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL #118645
  • gh-116322: Fix typo in the #ifdef check #122268
  • gh-116322: Fix typo in moduleobject.c #122282
  • [3.13] gh-116322: Fix typo in the GH-ifdef check (GH-122268) #122284
Reacted by Erlend E. Aasland and Ellis Breen

Activity

  1. swtaarrs
    added
    type-featureA feature request or enhancementA feature request or enhancement
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    topic-free-threading
    on Mar 4, 2024
  2. swtaarrs
    self-assigned this
    on Mar 11, 2024
  3. swtaarrs commented on Mar 11, 2024

    @swtaarrs
    swtaarrs
    on Mar 11, 2024
    MemberAuthor
    More actions

    What warning category should this issue? ImportWarning sounds like a good fit at first, but it's ignored by the default warning filters, which we don't want. Of the categories not ignored by default, RuntimeWarning seems like the best fit to me.

  4. swtaarrs
    changed the title [-]Implement `Py_mod_gil` slot for free-threading-safe extensions[/-] [+]Allow C extensions to declare compatibility with free-threading[/+] on May 2, 2024
  5. colesbury
    added a commit that references this issue on May 3, 2024

    gh-116322: Add Py_mod_gil module slot (#116882)

    c2627d6
  6. encukou
    added 2 commits that reference this issue on May 6, 2024

    pythongh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Mod…

    82f3c58

    gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_Se…

    417dd3a
  7. colesbury
    added a commit that references this issue on May 7, 2024

    gh-116322: Enable the GIL while loading C extension modules (#118560)

    853163d
  8. colesbury commented on May 7, 2024

    @colesbury
    colesbury
    on May 7, 2024
    Contributor
    More actions

    @swtaarrs is this finished now?

  9. swtaarrs commented on May 7, 2024

    @swtaarrs
    swtaarrs
    on May 7, 2024
    MemberAuthor
    More actions

    Yep!

  10. swtaarrs
    closed this as completedon May 7, 2024
  11. SonicField
    added 3 commits that reference this issue on May 8, 2024

    pythongh-116322: Add Py_mod_gil module slot (python#116882)

    f301715

    pythongh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Mod…

    7678b39

    pythongh-116322: Enable the GIL while loading C extension modules (py…

    0d76d9c
  12. colesbury
    added a commit that references this issue on Jul 25, 2024

    pythongh-116322: Fix typo in moduleobject.c

    1aebb36
  13. kumaraditya303
    added a commit that references this issue on Jul 25, 2024

    gh-116322: Fix typo in the #ifdef check (#122268)

    9bb2e46
  14. miss-islington
    added a commit that references this issue on Jul 25, 2024

    pythongh-116322: Fix typo in the GH-ifdef check (pythonGH-122268)

    f2060f1
  15. AlexWaygood
    added a commit that references this issue on Jul 25, 2024

    Merge branch 'main' into pythongh-116322-typo

    47d9618
  16. kumaraditya303
    added a commit that references this issue on Jul 25, 2024

    [3.13] gh-116322: Fix typo in the GH-ifdef check (GH-122268) (#122284)

    88a96fc
  17. stefanholek
    added a commit that references this issue on Oct 14, 2024

    Mark readline module in no-gil builds.

    65457c6
  18. danielivascsenko2-ux commented on Aug 22, 2025

    @danielivascsenko2-ux
    danielivascsenko2-ux
    on Aug 22, 2025 · Hidden as spam
    show commentMore actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @swtaarrs
    swtaarrs

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-featureA feature request or enhancementA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.