[issue20658] os.environ.clear() fails with empty keys (posix.unsetenv)
daniel hahler
report at bugs.python.org
Mon Feb 17 14:06:08 CET 2014
New submission from daniel hahler:
posix.unsetenv fails to clear the environment if there's an entry with an empty key.
TEST CASE:
Python 2.7.6 (default, Jan 6 2014, 17:05:19)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ['']='foo'
>>> os.environ.clear()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/python/2.7.6/lib/python2.7/os.py", line 499, in clear
unsetenv(key)
OSError: [Errno 22] Invalid argument
I believe that os.environ.clear() via unsetenv should handle empty keys.
----------
components: Interpreter Core
messages: 211415
nosy: blueyed
priority: normal
severity: normal
status: open
title: os.environ.clear() fails with empty keys (posix.unsetenv)
type: crash
versions: Python 2.7, Python 3.3
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20658>
_______________________________________
More information about the Python-bugs-list
mailing list