Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.8] bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) #17488

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Dec 6, 2019

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.
(cherry picked from commit 723f71a)

Co-authored-by: Benoit Hudson benoit@imgspc.com

https://bugs.python.org/issue37931

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.
(cherry picked from commit 723f71a)

Co-authored-by: Benoit Hudson <benoit@imgspc.com>
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good bot.

@miss-islington
Copy link
Contributor Author

@benoithudson and @vstinner: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 836cf31 into python:3.8 Dec 6, 2019
@miss-islington miss-islington deleted the backport-723f71a-3.8 branch December 6, 2019 19:32
@miss-islington
Copy link
Contributor Author

@benoithudson and @vstinner: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington
Copy link
Contributor Author

@benoithudson and @vstinner: Status check is done, and it's a success ✅ .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants