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 — [C API] Move private PyCode and PyOptimizer API to the internal C API · Issue #120642 · python/cpython

[C API] Move private PyCode and PyOptimizer API to the internal C API #120642

New issue
Copy link
New issue
Copy link
Closed
Closed
[C API] Move private PyCode and PyOptimizer API to the internal C API#120642
Copy link

Description

@vstinner
vstinner
opened on Jun 17, 2024
Issue body actions

The private PyCode and PyOptimizer APIs use "unnamed structs/unions" which are not allowed in ISO C99: see #120293.

I propose to move private PyCode and PyOptimizer APIs to the internal C API.

6 PyUnstable optimizer functions are moved to the internal C API:

  • PyUnstable_Replace_Executor()
  • PyUnstable_SetOptimizer()
  • PyUnstable_GetOptimizer()
  • PyUnstable_GetExecutor()
  • PyUnstable_Optimizer_NewCounter()
  • PyUnstable_Optimizer_NewUOpOptimizer()

Linked PRs

  • gh-120642: Move private PyCode APIs to the internal C API #120643
  • [3.13] gh-120642: Move private PyCode APIs to the internal C API (#120643) #121043
  • gh-120642: Move _PyCode_CODE() to the internal C API #121644
  • [3.13] gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644) #121729

Activity

  1. vstinner
    added a commit that references this issue on Jun 17, 2024

    pythongh-120642: Move private PyCode APIs to the internal C API

    118f88f
  2. ronaldoussoren commented on Jun 17, 2024

    @ronaldoussoren
    ronaldoussoren
    on Jun 17, 2024
    Contributor
    More actions

    These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes).

  3. vstinner commented on Jun 17, 2024

    @vstinner
    vstinner
    on Jun 17, 2024
    MemberAuthor
    More actions

    These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes).

    These functions are still exported, but the few other JITs would have to update their code to include pycore_optimizer.h. Is it ok?

  4. ronaldoussoren commented on Jun 19, 2024

    @ronaldoussoren
    ronaldoussoren
    on Jun 19, 2024
    Contributor
    More actions

    These functions were added in #104584, and may be intended as an API used by other JITs as well (possibly with some changes).

    These functions are still exported, but the few other JITs would have to update their code to include pycore_optimizer.h. Is it ok?

    I don't know. @markshannon added these function and may have an opinion on this.

  5. vstinner commented on Jun 20, 2024

    @vstinner
    vstinner
    on Jun 20, 2024
    MemberAuthor
    More actions

    @iritkatriel @brandtbucher @Fidget-Spinner: Do you know anyone using these unstable functions outside Python itself? They were added to Python 3.13. I propose to move them to <pycore_optimizer.h>. In short, are you ok with #120643 ?

    I prefer to move private APIs to the internal C API, and the API is causing C99 compatibility issues in strict mode (pedantic).

  6. Fidget-Spinner commented on Jun 20, 2024

    @Fidget-Spinner
    Fidget-Spinner
    on Jun 20, 2024
    Member
    More actions

    From what I am aware of, I don't know anyone using these APIs outside of Python itself. However, they are meant to be used as unstable APIs, so not sure where they are supposed to go normally?

  7. markshannon commented on Jun 20, 2024

    @markshannon
    markshannon
    on Jun 20, 2024
    Member
    More actions

    I think it is fine to remove them, as no one is using this API.
    If there is interest in the future for plug in optimizers, we would probably want to offer a quite different API that allowed plugins to add additional passes, rather replace the whole of tier 2.

  8. vstinner commented on Jun 20, 2024

    @vstinner
    vstinner
    on Jun 20, 2024
    MemberAuthor
    More actions

    I think it is fine to remove them, as no one is using this API.

    Oh ok. I updated my PR to remove the 6 PyUnstable functions from the public C API. Most of them have to be kept for tests, but I renamed them and moved them to the internal C API.

  9. vstinner
    added 4 commits that reference this issue on Jun 26, 2024

    gh-120642: Move private PyCode APIs to the internal C API (#120643)

    9e4a81f

    pythongh-120642: Move private PyCode APIs to the internal C API (pyth…

    a00e53f

    pythongh-120642: Move private PyCode APIs to the internal C API (pyth…

    c3f2f6e

    [3.13] gh-120642: Move private PyCode APIs to the internal C API (#12…

    e26e098
  10. vstinner
    closed this as completedon Jun 26, 2024
  11. mrahtz
    added a commit that references this issue on Jun 30, 2024

    pythongh-120642: Move private PyCode APIs to the internal C API (pyth…

    a3adbfb
  12. vstinner
    added 2 commits that reference this issue on Jul 12, 2024

    pythongh-120642: Move _PyCode_CODE() to the internal C API

    57190ff

    gh-120642: Move _PyCode_CODE() to the internal C API (#121644)

    a2bec77
  13. miss-islington
    added a commit that references this issue on Jul 13, 2024

    pythongh-120642: Move _PyCode_CODE() to the internal C API (pythonGH-…

    711cd69
  14. vstinner
    added a commit that references this issue on Jul 13, 2024

    [3.13] gh-120642: Move _PyCode_CODE() to the internal C API (GH-121644)…

    48a96d2
  15. estyxx
    added 2 commits that reference this issue on Jul 17, 2024

    pythongh-120642: Move private PyCode APIs to the internal C API (pyth…

    7f14dc3

    pythongh-120642: Move _PyCode_CODE() to the internal C API (python#12…

    560c73f
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

    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.