@@ -741,7 +741,7 @@ def getmodule(object, _filename=None): |
|
|
741 |
741 |
return sys.modules.get(modulesbyfile[file]) |
742 |
742 |
# Update the filename to module name cache and check yet again |
743 |
743 |
# Copy sys.modules in order to cope with changes while iterating |
744 |
|
-for modname, module in list(sys.modules.items()): |
|
744 |
+for modname, module in sys.modules.copy().items(): |
745 |
745 |
if ismodule(module) and hasattr(module, '__file__'): |
746 |
746 |
f = module.__file__ |
747 |
747 |
if f == _filesbymodname.get(modname, None): |