提交 650934ae authored 作者: Frederic Bastien's avatar Frederic Bastien

Small modif following code review

上级 8f43baf5
...@@ -377,7 +377,7 @@ def is_same_entry(entry_1, entry_2): ...@@ -377,7 +377,7 @@ def is_same_entry(entry_1, entry_2):
def get_module_hash(src_code, key): def get_module_hash(src_code, key):
""" """
Return a SHA256 (for FIPS compatibility) hash that uniquely identifies a module. Return a SHA256 hash that uniquely identifies a module.
This hash takes into account: This hash takes into account:
1. The C source code of the module (`src_code`). 1. The C source code of the module (`src_code`).
...@@ -416,11 +416,10 @@ def get_module_hash(src_code, key): ...@@ -416,11 +416,10 @@ def get_module_hash(src_code, key):
to_hash += list(key_element) to_hash += list(key_element)
elif isinstance(key_element, string_types): elif isinstance(key_element, string_types):
if (key_element.startswith('md5:') or if (key_element.startswith('md5:') or
key_element.startswith('sha256:') or
key_element.startswith('hash:')): key_element.startswith('hash:')):
# This is actually a sha256 hash of the config options. # This is actually a sha256 hash of the config options.
# Currently, we still keep md5 to don't break old Theano. # Currently, we still keep md5 to don't break old Theano.
# We add 'sha256:' and 'hash:' so that when we change it in # We add 'hash:' so that when we change it in
# the futur, it won't break this version of Theano. # the futur, it won't break this version of Theano.
break break
elif (key_element.startswith('NPY_ABI_VERSION=0x') or elif (key_element.startswith('NPY_ABI_VERSION=0x') or
...@@ -452,7 +451,7 @@ def get_safe_part(key): ...@@ -452,7 +451,7 @@ def get_safe_part(key):
# Find the hash part. This is actually a sha256 hash of the config # Find the hash part. This is actually a sha256 hash of the config
# options. Currently, we still keep md5 to don't break old # options. Currently, we still keep md5 to don't break old
# Theano. We add 'sha256:' and 'hash:' so that when we change it # Theano. We add 'hash:' so that when we change it
# in the futur, it won't break this version of Theano. # in the futur, it won't break this version of Theano.
c_link_key = key[1] c_link_key = key[1]
# In case in the future, we don't have an md5 part and we have # In case in the future, we don't have an md5 part and we have
...@@ -464,9 +463,6 @@ def get_safe_part(key): ...@@ -464,9 +463,6 @@ def get_safe_part(key):
if key_element.startswith('md5:'): if key_element.startswith('md5:'):
hash = key_element[4:] hash = key_element[4:]
break break
elif key_element.startswith('sha256:'):
hash = key_element[7:]
break
elif key_element.startswith('hash:'): elif key_element.startswith('hash:'):
hash = key_element[5:] hash = key_element[5:]
break break
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论