bpo-32030: Add _PyMainInterpreterConfig_ReadEnv()#4542
Merged
vstinner merged 3 commits intopython:masterfrom Nov 24, 2017
vstinner:mainconfig_read
Merged
bpo-32030: Add _PyMainInterpreterConfig_ReadEnv()#4542vstinner merged 3 commits intopython:masterfrom vstinner:mainconfig_read
vstinner merged 3 commits intopython:masterfrom
vstinner:mainconfig_read
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()
Member
Author
|
@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. |
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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