bpo-36301: Add _Py_GetEnv() function (GH-12542) · python/cpython@f78a5e9 (original) (raw)

`@@ -610,14 +610,14 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2)

`

610

610

`}

`

611

611

``

612

612

``

613

``

`-

const char*

`

``

613

`+

static const char*

`

614

614

`_PyCoreConfig_GetEnv(const _PyCoreConfig *config, const char *name)

`

615

615

`{

`

616

``

`-

return _PyPreConfig_GetEnv(&config->preconfig, name);

`

``

616

`+

return _Py_GetEnv(config->preconfig.use_environment, name);

`

617

617

`}

`

618

618

``

619

619

``

620

``

`-

int

`

``

620

`+

static int

`

621

621

`_PyCoreConfig_GetEnvDup(const _PyCoreConfig *config,

`

622

622

`wchar_t **dest,

`

623

623

`wchar_t *wname, char *name)

`

`@@ -924,34 +924,34 @@ config_wstr_to_int(const wchar_t *wstr, int *result)

`

924

924

`static _PyInitError

`

925

925

`config_read_env_vars(_PyCoreConfig *config)

`

926

926

`{

`

927

``

`-

_PyPreConfig *preconfig = &config->preconfig;

`

``

927

`+

int use_env = config->preconfig.use_environment;

`

928

928

``

929

929

`/* Get environment variables */

`

930

``

`-

_Py_get_env_flag(preconfig, &config->parser_debug, "PYTHONDEBUG");

`

931

``

`-

_Py_get_env_flag(preconfig, &config->verbose, "PYTHONVERBOSE");

`

932

``

`-

_Py_get_env_flag(preconfig, &config->optimization_level, "PYTHONOPTIMIZE");

`

933

``

`-

_Py_get_env_flag(preconfig, &config->inspect, "PYTHONINSPECT");

`

``

930

`+

_Py_get_env_flag(use_env, &config->parser_debug, "PYTHONDEBUG");

`

``

931

`+

_Py_get_env_flag(use_env, &config->verbose, "PYTHONVERBOSE");

`

``

932

`+

_Py_get_env_flag(use_env, &config->optimization_level, "PYTHONOPTIMIZE");

`

``

933

`+

_Py_get_env_flag(use_env, &config->inspect, "PYTHONINSPECT");

`

934

934

``

935

935

`int dont_write_bytecode = 0;

`

936

``

`-

_Py_get_env_flag(preconfig, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");

`

``

936

`+

_Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");

`

937

937

`if (dont_write_bytecode) {

`

938

938

`config->write_bytecode = 0;

`

939

939

` }

`

940

940

``

941

941

`int no_user_site_directory = 0;

`

942

``

`-

_Py_get_env_flag(preconfig, &no_user_site_directory, "PYTHONNOUSERSITE");

`

``

942

`+

_Py_get_env_flag(use_env, &no_user_site_directory, "PYTHONNOUSERSITE");

`

943

943

`if (no_user_site_directory) {

`

944

944

`config->user_site_directory = 0;

`

945

945

` }

`

946

946

``

947

947

`int unbuffered_stdio = 0;

`

948

``

`-

_Py_get_env_flag(preconfig, &unbuffered_stdio, "PYTHONUNBUFFERED");

`

``

948

`+

_Py_get_env_flag(use_env, &unbuffered_stdio, "PYTHONUNBUFFERED");

`

949

949

`if (unbuffered_stdio) {

`

950

950

`config->buffered_stdio = 0;

`

951

951

` }

`

952

952

``

953

953

`#ifdef MS_WINDOWS

`

954

``

`-

_Py_get_env_flag(preconfig, &config->legacy_windows_stdio,

`

``

954

`+

_Py_get_env_flag(use_env, &config->legacy_windows_stdio,

`

955

955

`"PYTHONLEGACYWINDOWSSTDIO");

`

956

956

`#endif

`

957

957

``