Skip to content
Snippets Groups Projects
Commit 6f6d8eab authored by Markus Holzer's avatar Markus Holzer
Browse files

Fix caching problem

parent 30641109
No related branches found
No related tags found
1 merge request!226Fix field size
......@@ -266,7 +266,6 @@ type_mapping = {
np.complex128: (('PyComplex_RealAsDouble', 'PyComplex_ImagAsDouble'), 'ComplexDouble'),
}
template_extract_scalar = """
PyObject * obj_{name} = PyDict_GetItemString(kwargs, "{name}");
if( obj_{name} == NULL) {{ PyErr_SetString(PyExc_TypeError, "Keyword argument '{name}' missing"); return NULL; }};
......@@ -418,7 +417,7 @@ def create_function_boilerplate_code(parameter_info, name, insert_checks=True):
extract_function_imag=extract_function[1],
target_type=target_type,
real_type="float" if target_type == "ComplexFloat"
else "double",
else "double",
name=param.symbol.name)
else:
pre_call_code += template_extract_scalar.format(extract_function=extract_function,
......@@ -564,8 +563,13 @@ def compile_module(code, code_hash, base_dir):
def compile_and_load(ast, custom_backend=None):
cache_config = get_cache_config()
code_hash_str = "mod_" + hashlib.sha256(generate_c(ast, dialect='c',
custom_backend=custom_backend).encode()).hexdigest()
generated_code = generate_c(ast, dialect='c', custom_backend=custom_backend)
fields_accessed = str(ast.fields_accessed)
# Also die Information of the field size should be contained in the hash string. Due to padding the generated code
# can look similar for different field sizes.
code_hash_str = "mod_" + hashlib.sha256((generated_code + fields_accessed).encode()).hexdigest()
code = ExtensionModuleCode(module_name=code_hash_str, custom_backend=custom_backend)
code.add_function(ast, ast.function_name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment