[issue1159] os.getenv() not updated after external module uses C putenv()

2007-09-13 Thread Robert Ancell
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

[issue1159] os.getenv() not updated after external module uses C putenv()

2007-09-13 Thread Robert Ancell
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

[issue1159] os.getenv() not updated after external module uses C putenv()

2007-09-13 Thread Robert Ancell
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