bpo-36301: Add _Py_GetEnv() function (GH-12542)

* Make _PyPreConfig_GetEnv(), _PyCoreConfig_GetEnv() and
  _PyCoreConfig_GetEnvDup() private
* _Py_get_env_flag() first parameter becomes "int use_environment"
This commit is contained in:
Victor Stinner 2019-03-26 00:03:15 +01:00 committed by GitHub
parent 548cb6060a
commit f78a5e9ce8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 32 deletions

View file

@ -655,7 +655,7 @@ pymain_run_file(_PyCoreConfig *config, PyCompilerFlags *cf)
static void
pymain_run_startup(_PyCoreConfig *config, PyCompilerFlags *cf)
{
const char *startup = _PyCoreConfig_GetEnv(config, "PYTHONSTARTUP");
const char *startup = _Py_GetEnv(config->preconfig.use_environment, "PYTHONSTARTUP");
if (startup == NULL) {
return;
}
@ -735,7 +735,7 @@ pymain_repl(_PyCoreConfig *config, PyCompilerFlags *cf, int *exitcode)
{
/* Check this environment variable at the end, to give programs the
opportunity to set it from Python. */
if (!Py_InspectFlag && _PyCoreConfig_GetEnv(config, "PYTHONINSPECT")) {
if (!Py_InspectFlag && _Py_GetEnv(config->preconfig.use_environment, "PYTHONINSPECT")) {
Py_InspectFlag = 1;
config->inspect = 1;
}