Skip to content
Snippets Groups Projects

Incorporate header files and compiler flags into object cache hash

Merged Michael Kuron requested to merge hash into master
+ 4
1
@@ -531,6 +531,9 @@ class ExtensionModuleCode:
@@ -531,6 +531,9 @@ class ExtensionModuleCode:
header_list = list(headers)
header_list = list(headers)
header_list.sort()
header_list.sort()
header_list.insert(0, '"Python.h"')
header_list.insert(0, '"Python.h"')
 
ps_headers = [os.path.join(os.path.dirname(__file__), '..', 'include', h[1:-1]) for h in header_list
 
if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'include', h[1:-1]))]
 
header_hash = b''.join([hashlib.sha256(open(h, 'rb').read()).digest() for h in ps_headers])
includes = "\n".join(["#include %s" % (include_file,) for include_file in header_list])
includes = "\n".join(["#include %s" % (include_file,) for include_file in header_list])
self._code_string += includes
self._code_string += includes
@@ -546,7 +549,7 @@ class ExtensionModuleCode:
@@ -546,7 +549,7 @@ class ExtensionModuleCode:
self._code_string += create_function_boilerplate_code(ast.get_parameters(), name, ast)
self._code_string += create_function_boilerplate_code(ast.get_parameters(), name, ast)
ast.function_name = old_name
ast.function_name = old_name
self._code_hash = "mod_" + hashlib.sha256(self._code_string.encode()).hexdigest()
self._code_hash = "mod_" + hashlib.sha256(self._code_string.encode() + header_hash).hexdigest()
self._code_string += create_module_boilerplate_code(self._code_hash, self._function_names)
self._code_string += create_module_boilerplate_code(self._code_hash, self._function_names)
def get_hash_of_code(self):
def get_hash_of_code(self):
Loading