diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2005-02-17 21:23:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2005-02-17 21:23:20 (GMT) |
commit | 5510f65f5a033eb8d0e9d90046087047410846f9 (patch) | |
tree | a4c660c83698b3404579c565f1072c3b5bbd5191 /Lib/os.py | |
parent | 3040b199768dbf1fc93ecb95dbd27ef9485fa03d (diff) | |
download | cpython-5510f65f5a033eb8d0e9d90046087047410846f9.zip cpython-5510f65f5a033eb8d0e9d90046087047410846f9.tar.gz cpython-5510f65f5a033eb8d0e9d90046087047410846f9.tar.bz2 |
Avoid using items() in environ.update(). Fixes #1124513.
Will backport to 2.4.
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -445,12 +445,17 @@ else: def update(self, dict=None, **kwargs): if dict: try: - items = dict.items() + keys = dict.keys() except AttributeError: # List of (key, value) - items = dict - for k, v in items: - self[k] = v + for k, v in dict: + self[k] = v + else: + # got keys + # cannot use items(), since mappings + # may not have them. + for k in keys: + self[k] = dict[k] if kwargs: self.update(kwargs) def copy(self): @@ -467,12 +472,17 @@ else: def update(self, dict=None, **kwargs): if dict: try: - items = dict.items() + keys = dict.keys() except AttributeError: # List of (key, value) - items = dict - for k, v in items: - self[k] = v + for k, v in dict: + self[k] = v + else: + # got keys + # cannot use items(), since mappings + # may not have them. + for k in keys: + self[k] = dict[k] if kwargs: self.update(kwargs) try: |