Skip to content

bpo-39395: os.putenv() is now always available #18135

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

Merged
merged 1 commit into from
Jan 24, 2020
Merged

bpo-39395: os.putenv() is now always available #18135

merged 1 commit into from
Jan 24, 2020

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jan 23, 2020

On non-Windows platforms, Python now requires setenv() to build.

https://bugs.python.org/issue39395

@vstinner
Copy link
Member Author

If this PR is merged, I plan to also require unsetenv() to build and always make os.unsetenv() available, once https://bugs.python.org/issue39413 will be fixed.

@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 23, 2020
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vstinner for commit d499e9a98444fb9dad78ca64f6ee2f42954db415 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 23, 2020
@vstinner
Copy link
Member Author

The PR built successfully on all tested buildbots: Linux (Ubuntu, Fedora, RHEL7, RHEL8, Gentoo, Arch Linux, ...), Windows (7, 8.1, 10, ...), macOS, FreeBSD.

I checked the 3 buildbot failures: they are unrelated.

@vstinner
Copy link
Member Author

Hum, I think I will wait until my PR #18163 is merged, so I can also require os.unsetenv() to be available in this PR.

The os.putenv() and os.unsetenv() functions are now always available.

On non-Windows platforms, Python now requires setenv() and unsetenv()
functions to build.

Remove putenv_dict from posixmodule.c: it's not longer needed.
@vstinner
Copy link
Member Author

I merged my PR #18163 so os.unsetenv() is now also available on Windows. I updated my PR to also require unsetenv() to build Python.

setenv() and unsetenv() should be available on all platforms supported by Python. If it's not the case, someone can maintain a downstream patch which is a revert of this PR.

Or we can revisit the idea of unsetting variables set by Python at exit, to workaround putenv() issue: https://bugs.python.org/issue39395

@vstinner
Copy link
Member Author

Or we can revisit the idea of unsetting variables set by Python at exit, to workaround putenv() issue: https://bugs.python.org/issue39395

I'm talking about something this PR #18078 that I just closed. But only if someone asks to support a platform which doesn't provide setenv() and unsetenv().

@vstinner vstinner merged commit b8d1262 into python:master Jan 24, 2020
@vstinner vstinner deleted the requires_setenv branch January 24, 2020 13:05
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
The os.putenv() and os.unsetenv() functions are now always available.

On non-Windows platforms, Python now requires setenv() and unsetenv()
functions to build.

Remove putenv_dict from posixmodule.c: it's not longer needed.
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.

3 participants