From 9068da4b6db66338c3bb17ec85dbbe158fb9a459 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 2 Jul 1999 02:54:02 +0000 Subject: 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.) --- Modules/posixmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index f7b16a0..2a1efa6 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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); } -- cgit v0.12