diff options
author | Gregory P. Smith <greg@krypto.org> | 2023-12-19 05:18:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-19 05:18:30 (GMT) |
commit | c895403de0b1c301aeef86921348c13f608257dc (patch) | |
tree | a0d87cb004a76b07acc7b8f9f7cb821506414cd1 /Modules | |
parent | 893c9ccf48eacb02fa6ae93632f2d0cb6778dbb6 (diff) | |
download | cpython-c895403de0b1c301aeef86921348c13f608257dc.zip cpython-c895403de0b1c301aeef86921348c13f608257dc.tar.gz cpython-c895403de0b1c301aeef86921348c13f608257dc.tar.bz2 |
gh-113119: Fix the macOS framework installer build (#113268)
`--enable-framework` builds were failing. we apparently do not have good CI & buildbot coverage here.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 8ffe0f5..c7ee591 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -1557,6 +1557,7 @@ error: ** man environ(7). */ #include <crt_externs.h> +#define USE_DARWIN_NS_GET_ENVIRON 1 #elif !defined(_MSC_VER) && (!defined(__WATCOMC__) || defined(__QNX__) || defined(__VXWORKS__)) extern char **environ; #endif /* !_MSC_VER */ @@ -1579,7 +1580,7 @@ convertenviron(void) through main() instead of wmain(). */ (void)_wgetenv(L""); e = _wenviron; -#elif defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) +#elif defined(USE_DARWIN_NS_GET_ENVIRON) /* environ is not accessible as an extern in a shared object on OSX; use _NSGetEnviron to resolve it. The value changes if you add environment variables between calls to Py_Initialize, so don't cache the value. */ @@ -7166,7 +7167,15 @@ py_posix_spawn(int use_posix_spawnp, PyObject *module, path_t *path, PyObject *a goto exit; } +#ifdef USE_DARWIN_NS_GET_ENVIRON + // There is no environ global in this situation. + char **environ = NULL; +#endif + if (env == Py_None) { +#ifdef USE_DARWIN_NS_GET_ENVIRON + environ = *_NSGetEnviron(); +#endif envlist = environ; } else { envlist = parse_envlist(env, &envc); |