summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-13 03:39:50 +0200
committerGitHub <noreply@github.com>2021-10-13 03:39:50 +0200
commit489176e4285314f9ea87b8bd91fe1d55d9af2c42 (patch)
tree66812e687f9136f54fe230944d1b4c71919e53f2 /Python
parent9c4766772cda67648184f8ddba546a5fc0167f91 (diff)
downloadcpython-git-489176e4285314f9ea87b8bd91fe1d55d9af2c42.tar.gz
bpo-45434: Convert Py_GETENV() macro to a function (GH-28912)
Avoid calling directly getenv() in the header file.
Diffstat (limited to 'Python')
-rw-r--r--Python/initconfig.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 2e3cde83b2..b91d280906 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 ----------------------------------------------- */