This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, serhiy.storchaka, vstinner
Date 2020-01-21.18:08:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579630126.23.0.178592769359.issue39406@roundup.psfhosted.org>
In-reply-to
Content
I created bpo-39413 "Implement os.unsetenv() on Windows" to prepare work on this issue. But Eryk raised the same concern about CRT: https://bugs.python.org/issue39413#msg360404

I wasn't aware of that :-/

> `_wputenv` keeps Python's copy of the environment block in sync with CRT's copy, which in turn calls `SetEnvironmentVariableW` to sync with process environment block. The CRT's copy of the environment excludes and disallows variable names that start with "=". Because the interpreter initializes `os.environ` from the CRT environment, Python has never included or allowed 'hidden' variables such as "=C:". 

My main motivation to use SetEnvironmentVariableW() on Windows is to avoid bpo-39395. Do you mean that Windows _putenv() is not affected by bpo-39395: Python can safely removes the string to _putenv() just after the call?
History
Date User Action Args
2020-01-21 18:08:46vstinnersetrecipients: + vstinner, serhiy.storchaka, eryksun
2020-01-21 18:08:46vstinnersetmessageid: <1579630126.23.0.178592769359.issue39406@roundup.psfhosted.org>
2020-01-21 18:08:46vstinnerlinkissue39406 messages
2020-01-21 18:08:46vstinnercreate