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:
parent
3427c1f71b
commit
9068da4b6d
|
@ -300,7 +300,8 @@ convertenviron()
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
continue;
|
continue;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
(void) PyDict_SetItemString(d, *e, v);
|
if (PyDict_GetItemString(d, *e) == NULL)
|
||||||
|
(void) PyDict_SetItemString(d, *e, v);
|
||||||
*p = '=';
|
*p = '=';
|
||||||
Py_DECREF(v);
|
Py_DECREF(v);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue