Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-113119: Fix the macOS framework installer build #113268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,7 @@ _Py_Sigset_Converter(PyObject *obj, void *addr)
** 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 */
Expand All @@ -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. */
Expand Down Expand Up @@ -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);
Expand Down