diff options
| author | Osvaldo Santana Neto <osantana@users.noreply.github.com> | 2017-07-01 14:34:45 -0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-07-01 20:34:45 +0300 |
| commit | 8a8d28501fc8ce25926d168f1c657656c809fd4c (patch) | |
| tree | e987cc31628e5c5dd7c4d07fafc9e0464659f0b3 /Lib/os.py | |
| parent | 85f643023fed3d4e2fb8e399f9ad57f3a65ef237 (diff) | |
| download | cpython-git-8a8d28501fc8ce25926d168f1c657656c809fd4c.tar.gz | |
bpo-30441: Fix bug when modifying os.environ while iterating over it (#2409)
Diffstat (limited to 'Lib/os.py')
| -rw-r--r-- | Lib/os.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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): |
