summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-09-20 17:57:59 (GMT)
committerGeorg Brandl <georg@python.org>2007-09-20 17:57:59 (GMT)
commit4a21268a749ee7461a4b744ddaa1fbcb0f22e7d5 (patch)
tree89bac425452d22734895bd553eaa298ddb5470e9 /Lib/os.py
parente2176020f99e2ac6598f95a537025aae46aced07 (diff)
downloadcpython-4a21268a749ee7461a4b744ddaa1fbcb0f22e7d5.zip
cpython-4a21268a749ee7461a4b744ddaa1fbcb0f22e7d5.tar.gz
cpython-4a21268a749ee7461a4b744ddaa1fbcb0f22e7d5.tar.bz2
Patch #1181: add os.environ.clear() method.
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 206aa37..7d21763 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -446,6 +446,10 @@ else:
def __delitem__(self, key):
unsetenv(key)
del self.data[key.upper()]
+ def clear(self):
+ for key in self.data.keys():
+ unsetenv(key)
+ del self.data[key]
def has_key(self, key):
return key.upper() in self.data
def __contains__(self, key):
@@ -503,6 +507,10 @@ else:
def __delitem__(self, key):
unsetenv(key)
del self.data[key]
+ def clear(self):
+ for key in self.data.keys():
+ unsetenv(key)
+ del self.data[key]
def copy(self):
return dict(self)