FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-149163: Add PyInitConfig API (PEP 741) to the limited C API by anujbharambe · Pull Request #149194 · python/cpython · GitHub

Repository navigation

gh-149163: Add PyInitConfig API (PEP 741) to the limited C API - #149194

Closed
anujbharambe wants to merge 6 commits into
python:mainfrom
anujbharambe:pyinitconfig-limited-api
Closed

anujbharambe wants to merge 6 commits into
python:mainfrom
anujbharambe:pyinitconfig-limited-api

Conversation

anujbharambe commented Apr 30, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

Closes #149163 --> cc @vstinner

Summary

Add the PEP 741 PyInitConfig API to the limited C API / stable ABI, so programs embedding Python (GDB, Vim, PyInstaller, etc.) can use the modern initialization API without building against the full C API.

  • Create new top-level Include/initconfig.h following the pylifecycle.h / longobject.h pattern
  • Move the opaque PyInitConfig typedef and 14 function declarations out of Include/cpython/initconfig.h into the new header, guarded by Py_LIMITED_API >= 0x030f0000
  • Register 1 struct + 14 functions in Misc/stable_abi.toml
  • Regenerate PC/python3dll.c, Lib/test/test_stable_abi_ctypes.py, Doc/data/stable_abi.dat
  • Add versionchanged note to Doc/c-api/init_config.rst
  • Add changelog entry to Doc/whatsnew/3.15.rst

Internal types (PyConfig, PyPreConfig, PyStatus, PyWideStringList) remain excluded from the limited API.

The PyInitConfig API is the modern way for programs embedding Python
to initialize the interpreter. However, it was excluded from the
limited C API, forcing embedders to use deprecated legacy APIs or
build against the full (unstable) C API.

Create a new top-level `Include/initconfig.h` header (following the
established `pylifecycle.h` / `longobject.h` pattern) that exposes
the opaque `PyInitConfig` struct and all 14 associated functions to
limited API consumers targeting Python 3.15+.

The internal types (PyConfig, PyPreConfig, PyStatus, etc.) remain
excluded from the limited API.

python-cla-bot Bot commented Apr 30, 2026 •
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

bedevere-app Bot commented Apr 30, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

anujbharambe force-pushed the pyinitconfig-limited-api branch from 4475d41 to 4c0dd7c Compare April 30, 2026 21:06
Comment thread Doc/tools/.nitignore

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is definitely wrong, there is no way this PR fixed all ~1000 issues. I assume something has broken, somewhere.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yeah you're right. The docs build was crashing before it could give any warnings. I have reverted the .nitignore changes and fixed the actual cause.

read-the-docs-community Bot commented Apr 30, 2026 •
edited
Loading

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32491594 | 📁 Comparing 74e052b against main (5110738)

  🔍 Preview build  

16 files changed · ± 16 modified

± Modified

Copy link
Copy Markdown
Contributor Author

All checks are passing now, this should be good to go. cc @StanFromIreland

Copy link
Copy Markdown
Member

Ah. I planned to write a PR once we will get an agreement on the adding PEP 741 to the limited C API, especially get an approval of the C API Working Group. IMO this PR was created too soon, and I suggest closing it.

Copy link
Copy Markdown
Contributor Author

Got it, didn't realize this still needed the C API WG approval. Happy to close this for now. Let me know if this is useful as a reference once things are agreed on, happy to reopen or rework it then.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PEP 741 PyInitConfig API to the limited C API

4 participants


Back | FazBrowse Home | New Git URL