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 — `--disable-gil` builds are not compatible with the limited API · Issue #111506 · python/cpython

--disable-gil builds are not compatible with the limited API #111506

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
--disable-gil builds are not compatible with the limited API#111506
Copy link
Assignees
encukou
Labels
3.13only security fixesonly security fixestopic-C-APItopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@colesbury
colesbury
opened on Oct 30, 2023
Issue body actions

Bug report

After #110764, --disable-gil builds of CPython 3.13 are (temporarily) not be compatible with the limited API or the stable ABI due to modifications to the PyObject header. For context, this was noted in the "Backwards Compatibility" section of PEP 703.

Based on feedback on the related discuss post and discussions with Gregory Smith, Guido, Petr, and Victor at the core dev sprint, I believe we can make changes to the stable ABI so that extension author can target a single stable ABI that supports CPython 3.7+ and both the default build and the --disable-gil builds of CPython 3.13+.

These changes will require a PEP. This issue is intended just to keep track of the known problem.

The rough idea is:

  1. make a number of macro/inline functions (e.g., Py_SIZE, Py_TYPE, Py_SET_REFCNT, Py_REFCNT) "real" function calls in the stable ABI for CPython 3.13+
  2. When targeting CPython <= 3.12, use dynamic symbol lookup (GetProcAddress on Windows) or weak symbols (on Linux/macOS) to determine at runtime if the active CPython version provides the desired functions. Otherwise, fall back to old definitions of the above functions for CPython <= 3.12.

Linked PRs

  • gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C API #111508
  • gh-111506: Implement Py_REFCNT() as opaque function call #112747
  • gh-111506: Rename _Py_SetRefcnt() to Py_SET_REFCNT() #112794
  • gh-111506: Implement Py_SET_REFCNT() as inline function #112798
  • gh-111506: Error if the limited API is used in free-threaded build #117762
  • gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API #136505
Reacted by Justin Chu and impervius

Activity

Next
  1. colesbury
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    3.13only security fixesonly security fixes
    topic-free-threading
    on Oct 30, 2023
  2. corona10 commented on Oct 30, 2023

    @corona10
    corona10
    on Oct 30, 2023
    Member
    More actions

    cc @vstinner

  3. vstinner
    added 2 commits that reference this issue on Oct 30, 2023

    pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…

    485ad40

    pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…

    67638c4
  4. vstinner commented on Oct 30, 2023

    @vstinner
    vstinner
    on Oct 30, 2023
    Member
    More actions

    Before creating a whole new ABI, I would like first to avoid __asm__(...); in Include/*.h, in the limited C API. Assembly code is not portable and can cause compilation issues.

    A first step for that is to implement Py_SET_REFCNT() as a function call: PR #111508.

  5. vstinner
    added a commit that references this issue on Oct 30, 2023

    pythongh-111506: Implement Py_SET_REFCNT() as opaque function in limi…

    ac0c1dd
  6. encukou commented on Oct 31, 2023

    @encukou
    encukou
    on Oct 31, 2023
    Member
    More actions

    These changes will require a PEP.

    Please, could we have the PEP first, then do the changes?

  7. AlexWaygood
    added
    topic-C-API
    on Oct 31, 2023
  8. vstinner
    added a commit that references this issue on Nov 3, 2023

    gh-111506: Implement Py_SET_REFCNT() as opaque function in limited C …

    20cfab9
  9. vstinner
    added 2 commits that reference this issue on Dec 5, 2023

    pythongh-111506: Implement Py_REFCNT() as opaque function call

    d52b1e9

    pythongh-111506: Implement Py_REFCNT() as opaque function call

    4fd7ed6
  10. encukou commented on Dec 5, 2023

    @encukou
    encukou
    on Dec 5, 2023
    Member
    More actions

    Please, could we have the PEP first, then do the changes?

    @colesbury, do you still plan to write the PEP? Do you need any help?

  11. colesbury commented on Dec 5, 2023

    @colesbury
    colesbury
    on Dec 5, 2023
    ContributorAuthor
    More actions

    @encukou, yes I still intend to write the PEP. It just hasn't been as a high a priority as integrating the pieces of PEP 703.

  12. 35 remaining items

  13. zmedico
    added 2 commits that reference this issue on Oct 27, 2025

    Support Py_GIL_DISABLED

    5a37226

    Support Py_GIL_DISABLED

    b750891
  14. zmedico
    added 4 commits that reference this issue on Nov 18, 2025

    Support Py_GIL_DISABLED

    41a90cd

    Support Py_GIL_DISABLED

    fc573cc

    Support Py_GIL_DISABLED

    ebd1aa9

    Support Py_GIL_DISABLED

    2dd9a6c
  15. cclauss
    added a commit that references this issue on Nov 19, 2025

    Support Py_GIL_DISABLED (#206)

    ac7cb9e
  16. lpsinger
    added a commit that references this issue on Dec 4, 2025

    Fix free-threaded Python builds

    3e2b38d
  17. hubot
    added a commit that references this issue on Jan 6, 2026

    wheel: Don't enable limited API when using a no-gil build

    056e79e
  18. kumaraditya303 commented on Apr 5, 2026

    @kumaraditya303
    kumaraditya303
    on Apr 5, 2026
    Contributor
    More actions

    Closing this in favor of #146636 which implements abi3t

    Reacted by Clément Robert
  19. kumaraditya303
    closed this as not plannedon Apr 5, 2026
  20. msk
    added a commit that references this issue on May 11, 2026

    py-setuptools: update to 73.0.1.

    4c6f72d
  21. jperkin
    added a commit that references this issue on May 14, 2026

    py-setuptools: update to 73.0.1.

    14b22b2
  22. mitrlk
    added a commit that references this issue on Sep 23, 2026

    ci: pin pyvista<0.49, it cannot install on free-threaded python

    71fa29c
  23. tsutsui
    added a commit that references this issue on Oct 17, 2026

    py-setuptools: update to 73.0.1.

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

Metadata

Metadata

Assignees

  • @encukou
    encukou

Labels

3.13only security fixesonly security fixestopic-C-APItopic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

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.