[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration
Raymond Hettinger
report at bugs.python.org
Sun Apr 19 17:22:26 EDT 2020
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
We should consider making this change just about everywhere in the standard library. Besides avoiding a race condition, running a for loop over `d.copy().items()` is more memory efficient and possibly faster than a for loop over `list(d.items())`.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40327>
_______________________________________
More information about the Python-bugs-list
mailing list