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 — Add support for the limited C API to Argument Clinic · Issue #108494 · python/cpython

Add support for the limited C API to Argument Clinic #108494

New issue
Copy link
New issue
Copy link
Closed
Closed
Add support for the limited C API to Argument Clinic#108494
Copy link
Labels
topic-argument-clinictype-featureA feature request or enhancementA feature request or enhancement

Description

@vstinner
vstinner
opened on Aug 25, 2023
Issue body actions

Feature or enhancement

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

  • [C API] Convert a few stdlib extensions to the limited C API (PEP 384) #85283
  • gh-85283: Extending Argument Clinic to support to use the limited C API. #26080

Proposal:

I propose adding support for the limited C API to Argument Clinic. Since Argument Clinic supports a wide diversity of parameter types and object types, I propose to add the support incrementally (step by step).

The final goal is to restrict some stdlib C extensions to the limited C API.

Linked PRs

  • gh-108494: Argument Clinic partial supports of Limited C API #108495
  • gh-108494: AC supports pos-only args in limited C API #108498
  • gh-108494: AC: change parse_file() API #108504
  • gh-108494: Fix AC limited C API for kwargs #108516
  • gh-108494: Argument Clinic: fix support of Limited C API #108536
  • gh-108494: Argument Clinic: fix option group for Limited C API #108574
  • gh-108494: Argument clinic: Improve the parse_file() API #108575
  • gh-108494: Argument Clinic: Document how to generate code that uses the limited C API #108584
  • gh-108494: Build _testclinic_limited on Windows #108589
  • gh-108494: Don't build _testclinic_limited with TraceRefs #108608
  • gh-108494: Argument Clinic: inline parsing code for positional-only parameters in the limited C API #108622
  • gh-108494: Document how to add a project in PCbuild/readme.txt #110077
  • [3.12] gh-108494: Document how to add a project in PCbuild/readme.txt (GH-110077) #110230
  • [3.11] gh-108494: Document how to add a project in PCbuild/readme.txt (#110077) #110232
  • gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX #116610

Activity

Next
  1. vstinner
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Aug 25, 2023
  2. vstinner
    added 2 commits that reference this issue on Aug 25, 2023

    pythongh-108494: Argument Clinic partial supports of Limited C API

    d1f9bed

    gh-108494: Argument Clinic partial supports of Limited C API (#108495)

    1dd9510
  3. vstinner commented on Aug 25, 2023

    @vstinner
    vstinner
    on Aug 25, 2023
    MemberAuthor
    More actions

    My first change adds this code to build _testclinic_limited.c with the limited C API:

        # XXX Temporary solution
        if os.path.basename(filename) == '_testclinic_limited.c':
            print(f"{filename} uses limited C API")
            limited_capi = True
    

    Maybe we could add a marker using Argument Clinic syntax to announce "hey, I want the limited C API"!

    Or AC could parse the C code and look for #define Py_LIMITED_API?

  4. vstinner
    added 2 commits that reference this issue on Aug 25, 2023

    pythongh-108494: AC supports pos-only args in limited C API

    8da84e6

    pythongh-108494: AC supports pos-only args in limited C API

    c38deb5
  5. vstinner commented on Aug 25, 2023

    @vstinner
    vstinner
    on Aug 25, 2023
    MemberAuthor
    More actions

    My change added support for limited C API version 3.13. If we consider supporting older Python versions, this issue should be carefully reviewed: #71686 "PY_SSIZE_T_CLEAN conflicts with Py_LIMITED_API". Maybe it has been fixed in the meanwhile, I'm not sure. The goal here would be to be able build a C extension with Python 3.13 which works on Python 3.2 to 3.12.

  6. vstinner commented on Aug 25, 2023

    @vstinner
    vstinner
    on Aug 25, 2023
    MemberAuthor
    More actions

    Something else to consider, @shihai1991 wrote:

    METH_FASTCALL is the part of the stable ABI in #23009.

    I don't in which Python version it was usable as part of the stable ABI. My current implementation is limited to METH_VARARGS and METH_VARARGS | METH_KEYWORDS to focus on backward compatibility first.

  7. vstinner commented on Aug 25, 2023

    @vstinner
    vstinner
    on Aug 25, 2023
    MemberAuthor
    More actions

    Well, see issue #85283 for the interesting discussion in 2020-2021.

  8. vstinner
    added a commit that references this issue on Aug 25, 2023

    gh-108494: AC supports pos-only args in limited C API (#108498)

    86bc9e3
  9. vstinner commented on Aug 25, 2023

    @vstinner
    vstinner
    on Aug 25, 2023
    MemberAuthor
    More actions

    Or AC could parse the C code and look for #define Py_LIMITED_API?

    I implemented that in my second PR, see LIMITED_CAPI_REGEX.

  10. vstinner
    added 2 commits that reference this issue on Aug 26, 2023

    pythongh-108494: AC: change parse_file() API

    46f74b4

    pythongh-108494: AC: change parse_file() API

    e9753e5
  11. serhiy-storchaka
    added
    topic-argument-clinic
    on Aug 26, 2023
  12. vstinner
    added a commit that references this issue on Aug 26, 2023

    pythongh-108494: Fix AC limited C API for kwargs

    de98b3f
  13. 30 remaining items

  14. miss-islington
    added a commit that references this issue on Oct 2, 2023

    pythongh-108494: Document how to add a project in PCbuild/readme.txt (p…

    8c86557
  15. vstinner
    added 4 commits that reference this issue on Oct 2, 2023

    pythongh-108494: Document how to add a project in PCbuild/readme.txt (p…

    0948cda

    pythongh-108494: Document how to add a project in PCbuild/readme.txt (p…

    562dc61

    [3.11] gh-108494: Document how to add a project in PCbuild/readme.txt (…

    981696e

    [3.12] gh-108494: Document how to add a project in PCbuild/readme.txt (…

    74d0b60
  16. vstinner commented on Oct 17, 2023

    @vstinner
    vstinner
    on Oct 17, 2023
    MemberAuthor
    More actions

    Thanks to @serhiy-storchaka, Argument Clinic now supports all formats for the limited C API. I'm sure that we will find code which doesn't work and room for improvement. It can be done later. I close the issue. Thanks to everybody who helped me to make it possible :-)

  17. vstinner
    closed this as completedon Oct 17, 2023
  18. vstinner commented on Oct 17, 2023

    @vstinner
    vstinner
    on Oct 17, 2023
    MemberAuthor
    More actions

    Follow-up: PR #110964 "[C API] Move undocumented private _PyArg C API to pycore_modsupport.h internal C API".

  19. vstinner
    added 4 commits that reference this issue on Mar 11, 2024

    pythongh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX

    5ea178c

    pythongh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX

    4a85026

    pythongh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX

    384b344

    gh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (#116610)

    2b67fc5
  20. adorilson
    added a commit that references this issue on Mar 25, 2024

    pythongh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (python#116610)

    2a2d0a7
  21. diegorusso
    added a commit that references this issue on Apr 17, 2024

    pythongh-108494: Fix Argument Clinic LIMITED_CAPI_REGEX (python#116610)

    d0e0e7d
  22. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-108494: Document how to add a project in PCbuild/readme.txt (p…

    6d1fc25
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

    topic-argument-clinictype-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.