summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2013-01-25 17:01:05 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2013-01-25 17:01:05 (GMT)
commit1c90eed8a9a10b6b7eb5f791931cc86754d4028c (patch)
tree62fbd65c674d54d1e1e64f5ffe1ace7dc822ae4b /Modules/posixmodule.c
parent96a9f89b2d67caf622c311e567d068a24962762a (diff)
parent697e56d0f592165209cbeb87583c75dc231c6338 (diff)
downloadcpython-1c90eed8a9a10b6b7eb5f791931cc86754d4028c.zip
cpython-1c90eed8a9a10b6b7eb5f791931cc86754d4028c.tar.gz
cpython-1c90eed8a9a10b6b7eb5f791931cc86754d4028c.tar.bz2
Issue #1602133: 'environ' is not really available with shared libraries on OSX (merge from 3.2)
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/posixmodule.c')
-rw-r--r--Modules/posixmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 90838c9..40645ea 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -955,9 +955,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;
@@ -982,7 +983,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