Skip to content

Remove _Py_InitializeMain() private function #129033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vstinner opened this issue Jan 19, 2025 · 3 comments
Closed

Remove _Py_InitializeMain() private function #129033

vstinner opened this issue Jan 19, 2025 · 3 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

vstinner commented Jan 19, 2025

PEP 587 "Python Initialization Configuration" added a "Multi-Phase Initialization Private Provisional API":

The plan was to make the "core phase" more usable. But since Python 3.8, Python doesn't use this "Multi-Phase Initialization" API and I failed to find any user in 3rd party code.

I propose to remove this API in Python 3.14 without any deprecation since the feature was provisional and it's a private API.

Provisional:

A provisional API is one which has been deliberately excluded from the standard library’s backwards compatibility guarantees.

Linked PRs

@vstinner
Copy link
Member Author

cc @ncoghlan @ericsnowcurrently

@vstinner
Copy link
Member Author

_PyInterpreterState_SetConfig() and _PyInterpreterState_GetConfigCopy() can also be removed if _Py_InitializeMain() is removed. PEP 741 "Python Configuration C API" added a public API for that: PyConfig_Set().

@picnixz picnixz added type-feature A feature request or enhancement interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API labels Jan 20, 2025
@ncoghlan
Copy link
Contributor

Makes sense to me. If an embedding application wants to split up interpreter initialisation and main module execution they can:

  1. Pass an empty string in run_command during initialisation
  2. Execute the relevant code in __main__.__dict__ later

vstinner added a commit that referenced this issue Jan 20, 2025
vstinner added a commit to vstinner/cpython that referenced this issue Jan 20, 2025
Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
vstinner added a commit to vstinner/cpython that referenced this issue Jan 20, 2025
Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
vstinner added a commit that referenced this issue Jan 20, 2025
Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this issue Jan 21, 2025
…hon#129048)

Remove _PyInterpreterState_GetConfigCopy() and
_PyInterpreterState_SetConfig() private functions. PEP 741 "Python
Configuration C API" added a better public C API: PyConfig_Get() and
PyConfig_Set().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants