New submission from Robert Ancell:
The Python os.getenv() function accesses an Python dictionary which is
mirroring the process environment. This dictionary is populated when the
interpreter starts and updated when os.environ.__setitem__() or
os.putenv() are called. However if the python program
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
Robert Ancell added the comment:
I've attached proof-of-concept showing how os.environ would ideally
work. It'll only work in Posix, etc etc.
Reading into it more there are a lot of general issues with environments
and memory allocation which is why I suspect Python doesn't use
putenv... See