[Python-checkins] cpython (merge 3.3 -> default): Issue #1602133: 'environ' is not really available with shared libraries on OSX
ronald.oussoren
python-checkins at python.org
Fri Jan 25 18:03:27 CET 2013
http://hg.python.org/cpython/rev/b41e3e2bd4cc
changeset: 81732:b41e3e2bd4cc
parent: 81728:ee48728e3695
parent: 81731:106d1d79c853
user: Ronald Oussoren <ronaldoussoren at mac.com>
date: Fri Jan 25 18:02:35 2013 +0100
summary:
Issue #1602133: 'environ' is not really available with shared libraries on OSX (merge from 3.3)
There already was a workaround for this for framework builds on OSX,
this changeset enables the same workaround for shared libraries.
Closes #1602133
files:
Misc/NEWS | 3 +++
Modules/posixmodule.c | 7 ++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -218,6 +218,9 @@
Library
-------
+- Issue #1602133: on Mac OS X a shared library build (``--enable-shared``)
+ now fills the ``os.environ`` variable correctly.
+
- Issue #9290: In IDLE the sys.std* streams now implement io.TextIOBase
interface and support all mandatory methods and properties.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -924,9 +924,10 @@
#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;
@@ -947,7 +948,7 @@
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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list