summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-06-13 21:52:41 (GMT)
committerGuido van Rossum <guido@python.org>2007-06-13 21:52:41 (GMT)
commitf5b46850e6b5bab2b2afa8858bdb6446f9adc6eb (patch)
tree5575fb5d17aa893eb6b0933568c0d3cdbf7a6235 /Lib
parent67aca9e04e5360007c46fde3d64debb4dad4d9ff (diff)
downloadcpython-f5b46850e6b5bab2b2afa8858bdb6446f9adc6eb.zip
cpython-f5b46850e6b5bab2b2afa8858bdb6446f9adc6eb.tar.gz
cpython-f5b46850e6b5bab2b2afa8858bdb6446f9adc6eb.tar.bz2
Reduce redundant calls to str() in _Environ class.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/os.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 2987cfc..f13850b 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -424,8 +424,9 @@ else:
def __getitem__(self, key):
return self.data[self.keymap(key)]
def __setitem__(self, key, value):
- self.putenv(key, str(value))
- self.data[self.keymap(key)] = str(value)
+ value = str(value)
+ self.putenv(key, value)
+ self.data[self.keymap(key)] = value
def __delitem__(self, key):
self.unsetenv(key)
del self.data[self.keymap(key)]
@@ -438,7 +439,7 @@ else:
return dict(self)
def setdefault(self, key, value):
if key not in self:
- self[key] = str(value)
+ self[key] = value
return self[key]
try: