[New-bugs-announce] [issue45353] sys.modules: dictionary changed size during iteration

Idan Cohen report at bugs.python.org
Sun Oct 3 10:36:51 EDT 2021


New submission from Idan Cohen <idan57 at gmail.com>:

Hi,

When iterating over sys.modules it might be that because of lazy loading or that other module reload is being reloaded (even if sys.modules.copy() is being used) you will get:

"RuntimeError: dictionary changed size during iteration"

The usage of sys.modules and iteration over it is used in many places

I know that this is a known issue but didn't find any solution or fix for that. Also, if there is some work around that might solve this, I would appreciate it.

Thanks,
Idan

----------
components: Library (Lib)
messages: 403089
nosy: idan57
priority: normal
severity: normal
status: open
title: sys.modules: dictionary changed size during iteration
versions: Python 3.8

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


More information about the New-bugs-announce mailing list