python / python/cpython

Add PEP 741 PyInitConfig API to the limited C API

Open
#149,163 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core topic-C-API
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

The GDB project would be interested to use the limited C API to embed Python. Some APIs used by GDB are missing from the limited C API (well, it's limited ;-)), one of them is the PEP 741 PyInitConfig API.

I propose adding PEP 741 PyInitConfig API to the limited C API.

PEP 741 Rationale lists other projects embedding Python. More projects would benefit from PyInitConfig being in the limited C API.

For example, the vim text editor uses dlopen/dlsym and GetProcAddress on Windows to get Python symbols at runtime. The libpython library is loaded on demand (at the first Python usage). vim already supports the stable ABI. See src/if_python3.c.

So far, I found pyinstaller which already adopted the PyInitConfig API.

Linked PRs
  • gh-149194

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read PEP 741's embedding rationale and inspect Vim's src/if_python3.c to understand the limited-ABI use case. Then review linked PR gh-149194 and the limited C API work; done means PyInitConfig is available through that API for projects embedding Python.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.