Milton L. Hankin reports that on Windows it is possible to have two

different values in the environ dict with the same key (although he
couldn't explain exactly how this came to be).  Since getenv() uses
the first one, Python should do too. (Some doubts about case
sensitivity, but for now this at least seems the right thing to do
regardless of platform.)
This commit is contained in:
Guido van Rossum 1999-07-02 02:54:02 +00:00
parent 3427c1f71b
commit 9068da4b6d
1 changed files with 2 additions and 1 deletions

View File

@ -300,7 +300,8 @@ convertenviron()
if (v == NULL)
continue;
*p = '\0';
(void) PyDict_SetItemString(d, *e, v);
if (PyDict_GetItemString(d, *e) == NULL)
(void) PyDict_SetItemString(d, *e, v);
*p = '=';
Py_DECREF(v);
}