[issue30441] os.environ raises RuntimeError: dictionary changed size during iteration

Antoine Pitrou report at bugs.python.org
Wed May 24 17:30:23 EDT 2017


Antoine Pitrou added the comment:

The environ class could have its own lock and then the __iter__ method could be rewritten as follows:

    def __iter__(self):
        with self._lock:
            keys = list(self._data)
        for key in keys:
            yield self.decodekey(key)

----------
nosy: +pitrou
versions: +Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30441>
_______________________________________


More information about the Python-bugs-list mailing list