(original) (raw)
changeset: 81731:106d1d79c853 branch: 3.3 parent: 81727:5464a534e7bd parent: 81730:ea9fd9c9c677 user: Ronald Oussoren ronaldoussoren@mac.com date: Fri Jan 25 18:01:05 2013 +0100 files: Misc/NEWS Modules/posixmodule.c description: 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 diff -r 5464a534e7bd -r 106d1d79c853 Misc/NEWS --- a/Misc/NEWS Fri Jan 25 15:34:34 2013 +0100 +++ b/Misc/NEWS Fri Jan 25 18:01:05 2013 +0100 @@ -150,6 +150,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 -r 5464a534e7bd -r 106d1d79c853 Modules/posixmodule.c --- a/Modules/posixmodule.c Fri Jan 25 15:34:34 2013 +0100 +++ b/Modules/posixmodule.c Fri Jan 25 18:01:05 2013 +0100 @@ -955,9 +955,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 static char **environ; @@ -982,7 +983,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/ronaldoussoren@mac.com