summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-07-02 02:54:02 +0000
committerGuido van Rossum <guido@python.org>1999-07-02 02:54:02 +0000
commit9068da4b6db66338c3bb17ec85dbbe158fb9a459 (patch)
tree209f9e0b08c18b6c8866f946d2eea289ae6e25e2
parent3427c1f71b584884142bc764be7b4f6b3efde3da (diff)
downloadcpython-git-9068da4b6db66338c3bb17ec85dbbe158fb9a459.tar.gz
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.)
-rw-r--r--Modules/posixmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index f7b16a05ef..2a1efa63a9 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);
}