diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-15 14:02:36 +0200 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-03-15 14:02:36 +0200 |
commit | 46dc65e8fdb2cfa2b254ad824a5b072808df6bad (patch) | |
tree | 47cf4d26ea93a96bbc12c1ef33421310eeba3ec2 /astroid/modutils.py | |
parent | 9d4e5f00e4e4222ec6e225fc7598245b6329ddc2 (diff) | |
download | astroid-git-46dc65e8fdb2cfa2b254ad824a5b072808df6bad.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.
Diffstat (limited to 'astroid/modutils.py')
-rw-r--r-- | astroid/modutils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/astroid/modutils.py b/astroid/modutils.py index c547f3e6..5ea6330b 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)): |