"Embedding Python in Another Application" documentation examples use deprecated functions
Examples of the C API documentation should be updated to use the new PyConfig API, rather than deprecated functions like Py_SetProgramName():
- https://docs.python.org/dev/c-api/intro.html#embedding-python
- https://docs.python.org/dev/extending/extending.html
- https://docs.python.org/dev/extending/embedding.html
In the intro, this paragraph is outdated:
The embedding application can steer the search by calling Py_SetProgramName(file) before calling Py_Initialize(). Note that PYTHONHOME still overrides this and PYTHONPATH is still inserted in front of the standard path. An application that requires total control has to provide its own implementation of Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix(), and Py_GetProgramFullPath() (all defined in Modules/getpath.c).
See also:
- gh-88052
- gh-93358
- gh-70702
- gh-68840
- gh-63352
- gh-42771
Perhaps we should mark those as superseded by this and actually update the docs :)
There are also slightly related issues:
- gh-83463
- gh-64423
When updating the embedding docs, the changes should be clear that the simple Py_Initialize and Py_InitializeEx configuration APIs are not deprecated: what's deprecated are the pre-init configuration API functions that rely on global variables to pass settings to the initialization functions. If embedders want non-default interpreter behaviour, they should switch over to the config struct based Py_InitializeFromConfig API.
Sadly, I failed to find the bandwidth to update the doc. I created this issue as a TODO item, but my TODO list is full of more important stuff as usual, so I prefer to close it. If someone is volunteer, please go ahead, the old API is now deprecated!