summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2005-01-29 13:29:23 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2005-01-29 13:29:23 (GMT)
commit1d11de6dbd247689c508de2ec28f0f3fc35ecabc (patch)
tree62a7f160f4a339382f748a8cfdb655522b16f289 /Lib/os.py
parent3069dbb8ec9c287c2ff6b3a1c8bfde83af81c11b (diff)
downloadcpython-1d11de6dbd247689c508de2ec28f0f3fc35ecabc.zip
cpython-1d11de6dbd247689c508de2ec28f0f3fc35ecabc.tar.gz
cpython-1d11de6dbd247689c508de2ec28f0f3fc35ecabc.tar.bz2
Revert os.py 1.75, and directly implement update.
Fixes #1110478 and #1100235.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index d3b9a8d..b967978 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -442,6 +442,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)
@@ -453,6 +464,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: