提交 c2e3b5b5 authored 作者: Frederic's avatar Frederic

Delete local var not used anymore and use the right variable instead of left previous left over.

fix hg-538
上级 a05a98e0
...@@ -755,6 +755,9 @@ class ModuleCache(object): ...@@ -755,6 +755,9 @@ class ModuleCache(object):
"directory to fix this.", "directory to fix this.",
self.entry_from_key[key], self.entry_from_key[key],
entry) entry)
# Clean up the name space to prevent bug.
if key_data.keys:
del key
self.loaded_key_pkl.add(key_pkl) self.loaded_key_pkl.add(key_pkl)
else: else:
too_old_to_use.append(entry) too_old_to_use.append(entry)
...@@ -763,6 +766,10 @@ class ModuleCache(object): ...@@ -763,6 +766,10 @@ class ModuleCache(object):
# directory, but a mod.* should be there. # directory, but a mod.* should be there.
# We do nothing here. # We do nothing here.
# Clean up the name space to prevent bug.
if root_dirs_files:
del root, dirs, files
# Remove entries that are not in the filesystem. # Remove entries that are not in the filesystem.
items_copy = list(self.module_hash_to_key_data.iteritems()) items_copy = list(self.module_hash_to_key_data.iteritems())
for module_hash, key_data in items_copy: for module_hash, key_data in items_copy:
...@@ -773,6 +780,7 @@ class ModuleCache(object): ...@@ -773,6 +780,7 @@ class ModuleCache(object):
gone = False gone = False
except IOError: except IOError:
gone = True gone = True
if gone: if gone:
# Assert that we did not have one of the deleted files # Assert that we did not have one of the deleted files
# loaded up and in use. # loaded up and in use.
...@@ -789,13 +797,13 @@ class ModuleCache(object): ...@@ -789,13 +797,13 @@ class ModuleCache(object):
_logger.info("deleting ModuleCache entry %s", entry) _logger.info("deleting ModuleCache entry %s", entry)
key_data.delete_keys_from(self.entry_from_key) key_data.delete_keys_from(self.entry_from_key)
del self.module_hash_to_key_data[module_hash] del self.module_hash_to_key_data[module_hash]
if key[0]: if os.path.exists(key_data.key_pkl):
# this is a versioned entry, so should have been on # this is a versioned entry, so should have been on
# disk. Something weird happened to cause this, so we # disk. Something weird happened to cause this, so we
# are responding by printing a warning, removing # are responding by printing a warning, removing
# evidence that we ever saw this mystery key. # evidence that we ever saw this mystery key.
pkl_file_to_remove = key_data.key_pkl pkl_file_to_remove = key_data.key_pkl
if not root.startswith("/tmp"): if not key_data.key_pkl.startswith("/tmp"):
# Under /tmp, file are removed periodically by the # Under /tmp, file are removed periodically by the
# os. So it is normal that this happen from time to # os. So it is normal that this happen from time to
# time. # time.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论