bpo-32030: Add _PyMainInterpreterConfig_ReadEnv()#4542
Conversation
Py_GetPath() and Py_Main() now call _PyMainInterpreterConfig_ReadEnv() to share the same code to get environment variables. Changes: * Add _PyMainInterpreterConfig_ReadEnv() * Add _PyMainInterpreterConfig_Clear() * Add _PyMem_RawWcsdup() * _PyMainInterpreterConfig: rename pythonhome to home * Rename _Py_ReadMainInterpreterConfig() to _PyMainInterpreterConfig_Read() * Use _Py_INIT_USER_ERR(), instead of _Py_INIT_ERR(), for decoding errors: the user is able to fix the issue, it's not a bug in Python. Same change was made in _Py_INIT_NO_MEMORY(). * Remove _Py_GetPythonHomeWithConfig()
|
@ncoghlan: Previously, I added _Py_GetPythonHomeWithConfig() to be able to iterate slowly on the code. With this change, I was able to remove _Py_GetPythonHomeWithConfig(). Py_GetPath() now also uses internally _PyMainInterpreterConfig to get environment variables. This change is the implementation of what I described you by email. This PR is only a small enhancement of the current code. You can still expect API changes. I tried to add program_name to _PyMainInterpreterConfig, but then I was stuck since _PyMainInterpreterConfig_ReadEnv() doesn't have access to argc and argv, whereas the code requires argv[0] to initialize program_name. I have to think about it to see how program_name can be initialized properly. |
Py_GetPath() and Py_Main() now call
_PyMainInterpreterConfig_ReadEnv() to share the same code to get
environment variables.
Changes:
_PyMainInterpreterConfig_Read()
errors: the user is able to fix the issue, it's not a bug in
Python. Same change was made in _Py_INIT_NO_MEMORY().
https://bugs.python.org/issue32030