Avoid RuntimeError caused by iteration over sys.modules
As is described in the doc[1], we should not iterate over sys.modules directly because sys.modules can be changed during iterations. [1] https://docs.python.org/3/library/sys.html#sys.modules Change-Id: Iad4e19744ee78996728e44f3a1446c1c282ad437
This commit is contained in:
@@ -56,7 +56,7 @@ CLSNAME_ALIASES = {
|
||||
('os_ken.lib.packet.ospf', 'StringifyMixin'): ''
|
||||
}
|
||||
|
||||
for modname, moddef in sys.modules.items():
|
||||
for modname, moddef in sys.modules.copy().items():
|
||||
if not modname.startswith(PKT_LIB_PATH) or not moddef:
|
||||
continue
|
||||
for (clsname, clsdef, ) in inspect.getmembers(moddef):
|
||||
|
Reference in New Issue
Block a user