Robert Ancell added the comment:
draghuram, unfortunately while os.putenv() can be fixed to be
symmetrical any putenv call from a C module cannot, for example:
If you make an extension:
#include <stdlib.h>
PyObject *putenvC(PyObject *module, PyObject *args)
{
int result;
if (!PyArg_ParseTuple(args, ""))
return 0;
result = putenv("FOO=BAR");
return Py_BuildValue("i", result);
}
The following behaviour will occur:
$ python
>>> import putenv
>>> putenv.putenvC()
>>> assert(os.getenv('FOO') == None)
>>> assert(os.environ.get('FOO') == None)
This is because the os.environ dictionary will never be updated:
>From Lib/os.py:
def getenv(key, default=None):
"""Get an environment variable, return None if it doesn't exist.
The optional second argument can specify an alternate default."""
return environ.get(key, default)
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1159>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com