Avoid calling directly getenv() in the header file.
/* 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
}
#undef SET_ITEM_STR
}
+char*
+Py_GETENV(const char *name)
+{
+ if (Py_IgnoreEnvironmentFlag) {
+ return NULL;
+ }
+ return getenv(name);
+}
/* --- PyStatus ----------------------------------------------- */