提交 94e31183 authored 作者: abergeron's avatar abergeron

Merge pull request #2895 from nouiz/cache

Keep the lock when we check the key
...@@ -960,9 +960,12 @@ class ModuleCache(object): ...@@ -960,9 +960,12 @@ class ModuleCache(object):
except cPickle.PicklingError: except cPickle.PicklingError:
key_data.remove_key(key) key_data.remove_key(key)
key_broken = True key_broken = True
if (key[0] and not key_broken and # We need the lock while we check in case of parallel
self.check_for_broken_eq): # process that could be changing the file at the same
self.check_key(key, key_data.key_pkl) # time.
if (key[0] and not key_broken and
self.check_for_broken_eq):
self.check_key(key, key_data.key_pkl)
self._update_mappings(key, key_data, module.__file__, check_in_keys=not key_broken) self._update_mappings(key, key_data, module.__file__, check_in_keys=not key_broken)
return module return module
else: else:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论