提交 50924b23 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix crash in refresh when a cache dir contains a key.pkl but no dll.

上级 8917fa7d
...@@ -295,7 +295,15 @@ class ModuleCache(object): ...@@ -295,7 +295,15 @@ class ModuleCache(object):
except: except:
# the directory is still in use?? We just leave it for future removal. # the directory is still in use?? We just leave it for future removal.
pass pass
elif 'key.pkl' in files and (time_now - last_access_time(module_name_from_dir(root)))<self.age_thresh_use: elif 'key.pkl' in files:
try:
entry = module_name_from_dir(root)
except ValueError: # there is a key but no dll!
warning("ModuleCache.refresh() Found key without dll in cache, deleting it.", key_pkl)
info("Erasing broken cache directory", key_pkl)
shutil.rmtree(root)
continue
if (time_now - last_access_time(module_name_from_dir(root)))<self.age_thresh_use:
key_pkl = os.path.join(root, 'key.pkl') key_pkl = os.path.join(root, 'key.pkl')
debug('refresh adding', key_pkl) debug('refresh adding', key_pkl)
try: try:
...@@ -319,14 +327,6 @@ class ModuleCache(object): ...@@ -319,14 +327,6 @@ class ModuleCache(object):
continue continue
if key not in self.entry_from_key: if key not in self.entry_from_key:
try:
entry = module_name_from_dir(root)
except ValueError: # there is a key but no dll!
warning("ModuleCache.refresh() Found key without dll in cache, deleting it.", key_pkl)
info("Erasing broken cache directory", key_pkl)
shutil.rmtree(root)
continue
self.entry_from_key[key] = entry self.entry_from_key[key] = entry
# assert that we haven't already got this entry somehow # assert that we haven't already got this entry somehow
assert entry not in self.module_from_name assert entry not in self.module_from_name
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论