diff options
-rw-r--r-- | Include/cpython/pydebug.h | 2 | ||||
-rw-r--r-- | Python/initconfig.c | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Include/cpython/pydebug.h b/Include/cpython/pydebug.h index 78bcb11..cab799f 100644 --- a/Include/cpython/pydebug.h +++ b/Include/cpython/pydebug.h @@ -29,7 +29,7 @@ PyAPI_DATA(int) Py_LegacyWindowsStdioFlag; /* this is a wrapper around getenv() that pays attention to Py_IgnoreEnvironmentFlag. It should be used for getting variables like PYTHONPATH and PYTHONHOME from the environment */ -#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) +PyAPI_DATA(char*) Py_GETENV(const char *name); #ifdef __cplusplus } diff --git a/Python/initconfig.c b/Python/initconfig.c index 2e3cde8..b91d280 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -249,6 +249,14 @@ fail: #undef SET_ITEM_STR } +char* +Py_GETENV(const char *name) +{ + if (Py_IgnoreEnvironmentFlag) { + return NULL; + } + return getenv(name); +} /* --- PyStatus ----------------------------------------------- */ |