[issue45353] sys.modules: dictionary changed size during iteration

Terry J. Reedy report at bugs.python.org
Sat Oct 9 14:13:17 EDT 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

In #13487, Gregory fixed the problem by using .copy().  That seems to have worked for 1 1/2 years.  You still have not reported an actual bug in the current CPython stdlib.

Perhaps we should mention in https://docs.python.org/3/library/sys.html#sys.modules that sys.modules can be unexpectedly changed during iteration by lazy imports or other threads, so that a copy might be needed.

Gregory, what do you think?

----------
nosy: +gregory.p.smith

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45353>
_______________________________________


More information about the Python-bugs-list mailing list