STINNER Victor <vstin...@python.org> added the comment:

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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39406>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to