diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-07-04 04:55:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-04 04:55:32 (GMT) |
commit | bebd2cfa5f21811dd0ee4f3b1a1b85d379b83436 (patch) | |
tree | b089cbbaf1aa59ae16419beb7523a6a57dfe1c1f /Lib/os.py | |
parent | 4132adb4b8f90893d8f19ff46edff56f189faca0 (diff) | |
download | cpython-bebd2cfa5f21811dd0ee4f3b1a1b85d379b83436.zip cpython-bebd2cfa5f21811dd0ee4f3b1a1b85d379b83436.tar.gz cpython-bebd2cfa5f21811dd0ee4f3b1a1b85d379b83436.tar.bz2 |
[3.6] bpo-30441: Fix bug when modifying os.environ while iterating over it (GH-2409). (#2556)
(cherry picked from commit 8a8d28501fc8ce25926d168f1c657656c809fd4c)
Diffstat (limited to 'Lib/os.py')
-rw-r--r-- | Lib/os.py | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -685,7 +685,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): |