Skip to content

bpo-32030: Fix _Py_InitializeEx_Private() #4649

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

Merged
merged 1 commit into from
Nov 30, 2017
Merged

bpo-32030: Fix _Py_InitializeEx_Private() #4649

merged 1 commit into from
Nov 30, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Nov 30, 2017

_Py_InitializeEx_Private() now calls
_PyMainInterpreterConfig_ReadEnv() to read environment variables
PYTHONHOME and PYTHONPATH, and set the program name.

https://bugs.python.org/issue32030

_Py_InitializeEx_Private() now calls
_PyMainInterpreterConfig_ReadEnv() to read environment variables
PYTHONHOME and PYTHONPATH, and set the program name.
@vstinner
Copy link
Member Author

While testing ptest.c attached to https://bugs.python.org/issue20891 I found a regression that I introduced during https://bugs.python.org/issue32030 refactoring. When Python is embedded, calling Py_Initialize() doesn't read PYTHONPATH nor PYTHONHOME anymore. This change fixes it.

I'm not sure if Py_Initialize() is supposed to read PYTHON* environment variables. Usually in case of doubt, I look at Python version N-1, so Python 3.6 in this case. Python 3.6 does read PYTHONPATH and PYTHONHOME in Py_Initialize() (except if Py_IgnoreEnvironmentFlag is non-zero).

@vstinner vstinner merged commit bc8ac6b into python:master Nov 30, 2017
@vstinner vstinner deleted the config_readenv branch November 30, 2017 17:03
@vstinner
Copy link
Member Author

I had to push this fix quickly to be able to write an unit test for my https://bugs.python.org/issue20891 fix: the PR #4650.

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.

3 participants