summaryrefslogtreecommitdiffstats
path: root/Lib/os.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/os.py')
-rw-r--r--Lib/os.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/os.py b/Lib/os.py
index e293eca..807ddb5 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -697,7 +697,9 @@ class _Environ(MutableMapping):
raise KeyError(key) from None
def __iter__(self):
- for key in self._data:
+ # list() from dict object is an atomic operation
+ keys = list(self._data)
+ for key in keys:
yield self.decodekey(key)
def __len__(self):