Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jan 21, 2020

Don't implement os.unsetenv() in C using
SetEnvironmentVariableW(name, NULL) anymore, but implement it in
Python as os.putenv(name, ""). _wputenv() is preferred since it
updates the CRT, whereas SetEnvironmentVariableW(name, NULL) does
not.

Replace also lambda functions with regular functions to get named
functions, to ease debug.

https://bugs.python.org/issue39413

Don't implement os.unsetenv() in C using
SetEnvironmentVariableW(name, NULL) anymore, but implement it in
Python as os.putenv(name, ""). _wputenv() is preferred since it
updates the CRT, whereas SetEnvironmentVariableW(name, NULL) does
not.

Replace also lambda functions with regular functions to get named
functions, to ease debug.
@vstinner
Copy link
Member Author

cc @serhiy-storchaka @eryksun

_unsetenv = unsetenv
except NameError:
_unsetenv = lambda key: _putenv(key, "")
if name == 'nt':
Copy link
Member

Choose a reason for hiding this comment

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

This looks too complicated and obscure. Many lines are duplicated with small differences. Would not it be easier to implement nt.unsetenv() on C?

@vstinner
Copy link
Member Author

@serhiy-storchaka: "This looks too complicated and obscure. Many lines are duplicated with small differences. Would not it be easier to implement nt.unsetenv() on C?"

Ok, I wrote PR #18115 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants