diff options
author | Guido van Rossum <guido@python.org> | 1999-07-02 02:54:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-07-02 02:54:02 (GMT) |
commit | 9068da4b6db66338c3bb17ec85dbbe158fb9a459 (patch) | |
tree | 209f9e0b08c18b6c8866f946d2eea289ae6e25e2 | |
parent | 3427c1f71b584884142bc764be7b4f6b3efde3da (diff) | |
download | cpython-9068da4b6db66338c3bb17ec85dbbe158fb9a459.zip cpython-9068da4b6db66338c3bb17ec85dbbe158fb9a459.tar.gz cpython-9068da4b6db66338c3bb17ec85dbbe158fb9a459.tar.bz2 |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); } |