提交 8d1929c2 authored 作者: Frederic Bastien's avatar Frederic Bastien

added another assert that explain why another one would fail. This make the error easier to track.

上级 e0e08753
...@@ -395,6 +395,7 @@ class ModuleCache(object): ...@@ -395,6 +395,7 @@ class ModuleCache(object):
debug('returning compiled module from cache', name) debug('returning compiled module from cache', name)
rval = self.module_from_name[name] rval = self.module_from_name[name]
else: else:
hash_key = hash(key)
# we have never seen this key before # we have never seen this key before
# Acquire lock before creating things in the compile cache, # Acquire lock before creating things in the compile cache,
# to avoid that other processes remove the compile dire while it # to avoid that other processes remove the compile dire while it
...@@ -418,6 +419,11 @@ class ModuleCache(object): ...@@ -418,6 +419,11 @@ class ModuleCache(object):
debug("Adding module to cache", key, name) debug("Adding module to cache", key, name)
assert name.startswith(location) assert name.startswith(location)
assert name not in self.module_from_name assert name not in self.module_from_name
#Changing the hash of the key is not allowed during compilation
#That is the only cause found that make the last assert fail.
assert hash(key)==hash_key
assert key not in self.entry_from_key
assert key not in self.entry_from_key assert key not in self.entry_from_key
if _version: # save they key if _version: # save they key
key_pkl = os.path.join(location, 'key.pkl') key_pkl = os.path.join(location, 'key.pkl')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论