diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-13 01:39:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 01:39:50 (GMT) |
commit | 489176e4285314f9ea87b8bd91fe1d55d9af2c42 (patch) | |
tree | 66812e687f9136f54fe230944d1b4c71919e53f2 /Python/initconfig.c | |
parent | 9c4766772cda67648184f8ddba546a5fc0167f91 (diff) | |
download | cpython-489176e4285314f9ea87b8bd91fe1d55d9af2c42.zip cpython-489176e4285314f9ea87b8bd91fe1d55d9af2c42.tar.gz cpython-489176e4285314f9ea87b8bd91fe1d55d9af2c42.tar.bz2 |
bpo-45434: Convert Py_GETENV() macro to a function (GH-28912)
Avoid calling directly getenv() in the header file.
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 ----------------------------------------------- */ |