[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)
STINNER Victor
report at bugs.python.org
Wed Feb 19 14:38:41 CET 2014
STINNER Victor added the comment:
> It comes from the real environment.
Oh. It looks possible to define an environment variable with an empty key, but not to remove it:
$ env -i =value python -c 'import pprint, os; pprint.pprint(os.environ); del os.environ[""]'
environ({'': 'value'})
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "Lib/os.py", line 662, in __delitem__
self.unsetenv(encodedkey)
OSError: [Errno 22] Invalid argument
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20658>
_______________________________________
More information about the Python-bugs-list
mailing list