bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)
On most platforms, the `environ` symbol is accessible everywhere.
In a dylib on OSX, it's not easily accessible, you need to find it with
_NSGetEnviron.
The code was caching the *value* of environ. But a setenv() can change the value,
leaving garbage at the old value. Fix: don't cache the value of environ, just
read it every time.
diff --git a/Misc/ACKS b/Misc/ACKS
index 357ce02..239d06f 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -733,6 +733,7 @@
Chiu-Hsiang Hsu
Chih-Hao Huang
Christian Hudon
+Benoît Hudson
Lawrence Hudson
Michael Hudson
Jim Hugunin
diff --git a/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst
new file mode 100644
index 0000000..45b54e8
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2019-08-23-12-14-34.bpo-37931.goYgQj.rst
@@ -0,0 +1,3 @@
+Fixed a crash on OSX dynamic builds that occurred when re-initializing the
+posix module after a Py_Finalize if the environment had changed since the
+previous `import posix`. Patch by Benoît Hudson.