[Python-checkins] python/dist/src/Lib os.py,1.83,1.83.2.1

loewis at users.sourceforge.net loewis at users.sourceforge.net
Sat Jan 29 14:33:30 CET 2005


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7293/Lib
Modified Files:
 Tag: release24-maint
	os.py 
Log Message:
Revert os.py 1.75, and directly implement update.
Fixes #1110478 and #1100235.
Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.83
retrieving revision 1.83.2.1
diff -u -d -r1.83 -r1.83.2.1
--- os.py	11 Oct 2004 18:12:15 -0000	1.83
+++ os.py	29 Jan 2005 13:33:23 -0000	1.83.2.1
@@ -435,6 +435,17 @@
 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 @@
 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:


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /