summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-01-29 13:33:27 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2005-01-29 13:33:27 (GMT)
commite6b1cc81456c966812b06d8dd1e2e61ed24cc46a (patch)
treeaf801e180b2e3f5f1ac8621db9583a77e608ef85
parent22f1b0990faa2033850d44bfba29dcb3777a32ad (diff)
downloadcpython-e6b1cc81456c966812b06d8dd1e2e61ed24cc46a.zip
cpython-e6b1cc81456c966812b06d8dd1e2e61ed24cc46a.tar.gz
cpython-e6b1cc81456c966812b06d8dd1e2e61ed24cc46a.tar.bz2
Revert os.py 1.75, and directly implement update.
Fixes #1110478 and #1100235.
-rw-r--r--Lib/os.py22
-rw-r--r--Misc/NEWS2
2 files changed, 24 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 65b1830..b34e413 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -435,6 +435,17 @@ else:
return key.upper() in self.data
def get(self, key, failobj=None):
return self.data.get(key.upper(), failobj)
+ def update(self, dict=None, **kwargs):
+ if dict:
+ try:
+ items = dict.items()
+ except AttributeError:
+ # List of (key, value)
+ items = dict
+ for k, v in items:
+ self[k] = v
+ if kwargs:
+ self.update(kwargs)
def copy(self):
return dict(self)
@@ -446,6 +457,17 @@ else:
def __setitem__(self, key, item):
putenv(key, item)
self.data[key] = item
+ def update(self, dict=None, **kwargs):
+ if dict:
+ try:
+ items = dict.items()
+ except AttributeError:
+ # List of (key, value)
+ items = dict
+ for k, v in items:
+ self[k] = v
+ if kwargs:
+ self.update(kwargs)
try:
unsetenv
except NameError:
diff --git a/Misc/NEWS b/Misc/NEWS
index 08d9057..33fd636 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -25,6 +25,8 @@ Core and builtins
Library
-------
+- Bug #1110478: Revert os.environ.update to do putenv again.
+
- Bug #1103844: fix distutils.install.dump_dirs() with negated options.
- Bug #1067732: wininst --install-script doesn't leave residual files anymore.