Kaydet (Commit) a066f46b authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Patch 550804: Make os.environ.copy() return a copy.

üst e0e890a4
...@@ -412,6 +412,8 @@ else: ...@@ -412,6 +412,8 @@ else:
def update(self, dict): def update(self, dict):
for k, v in dict.items(): for k, v in dict.items():
self[k] = v self[k] = v
def copy(self):
return dict(self)
else: # Where Env Var Names Can Be Mixed Case else: # Where Env Var Names Can Be Mixed Case
class _Environ(UserDict.UserDict): class _Environ(UserDict.UserDict):
...@@ -432,6 +434,8 @@ else: ...@@ -432,6 +434,8 @@ else:
def __delitem__(self, key): def __delitem__(self, key):
unsetenv(key) unsetenv(key)
del self.data[key] del self.data[key]
def copy(self):
return dict(self)
environ = _Environ(environ) environ = _Environ(environ)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment