diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2013-01-25 16:57:13 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2013-01-25 16:57:13 (GMT) |
commit | 697e56d0f592165209cbeb87583c75dc231c6338 (patch) | |
tree | fa101edf4496542ea809c2ebc5ef504d6fe296e5 /Modules | |
parent | 7981f202931ebef466464e172625a75161bb5fa0 (diff) | |
download | cpython-697e56d0f592165209cbeb87583c75dc231c6338.zip cpython-697e56d0f592165209cbeb87583c75dc231c6338.tar.gz cpython-697e56d0f592165209cbeb87583c75dc231c6338.tar.bz2 |
Issue #1602133: 'environ' is not really available with shared libraries on OSX
There already was a workaround for this for framework builds on OSX,
this changeset enables the same workaround for shared libraries.
Closes #1602133
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index e7e5305..4179c0e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -501,9 +501,10 @@ win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) #endif /* MS_WINDOWS */ /* Return a dictionary corresponding to the POSIX environment table */ -#ifdef WITH_NEXT_FRAMEWORK +#if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) /* On Darwin/MacOSX a shared library or framework has no access to -** environ directly, we must obtain it with _NSGetEnviron(). +** environ directly, we must obtain it with _NSGetEnviron(). See also +** man environ(7). */ #include <crt_externs.h> static char **environ; @@ -528,7 +529,7 @@ convertenviron(void) d = PyDict_New(); if (d == NULL) return NULL; -#ifdef WITH_NEXT_FRAMEWORK +#if defined(WITH_NEXT_FRAMEWORK) || (defined(__APPLE__) && defined(Py_ENABLE_SHARED)) if (environ == NULL) environ = *_NSGetEnviron(); #endif |