summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-03-15 14:02:36 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-03-15 14:02:36 +0200
commit59a00eec01124fe53a236a28374dbe12cd13ee47 (patch)
tree797bbc1e8ee31a6df1971423bbdd69c44b4b0947
parent9e6ad06426b335bce5756fa1ebe98486b40c57aa (diff)
downloadastroid-59a00eec01124fe53a236a28374dbe12cd13ee47.tar.gz
Make modutils._search_zip thread safe.
The function was iterating on sys.path_importer_cache.items(), which gets modified sometimes when using multiple threads. This patch wraps the call to .items() in a list() call.
-rw-r--r--astroid/modutils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/astroid/modutils.py b/astroid/modutils.py
index c547f3e..5ea6330 100644
--- a/astroid/modutils.py
+++ b/astroid/modutils.py
@@ -538,7 +538,7 @@ def _file_from_modpath(modpath, path=None, context=None):
return mp_filename, mtype
def _search_zip(modpath, pic):
- for filepath, importer in pic.items():
+ for filepath, importer in list(pic.items()):
if importer is not None:
if importer.find_module(modpath[0]):
if not importer.find_module(os.path.sep.join(modpath)):