Read about our upcoming Code of Conduct on this issue

Commit cb81c16c authored by Pierre Augier's avatar Pierre Augier
Browse files

Fix bugs: method no method + Scipy used by Pythran

parent ae3f81563ae8
......@@ -175,7 +175,7 @@ def gather_rawcode_comments(node, code_module):
# TODO complete the list
packages_supported_by_pythran = ["numpy", "math", "functools", "cmath"]
packages_supported_by_pythran = ["numpy", "math", "functools", "cmath", "scipy"]
# FIXME find path in non local imports
def find_path(node: object, pathfile: str):
......
......@@ -195,12 +195,17 @@ def produce_code_for_method(
str_args_value_func = ", ".join(str_args_value_func)
if str_self_dot_attributes:
str_args_pythran_func = ", ".join((str_self_dot_attributes, str_args_func))
else:
str_args_pythran_func = str_args_func
if jit:
name_new_method = f"__new_method__{class_name}__{meth_name}"
python_code += (
f"\ndef {name_new_method}"
f"(self, {str_args_value_func}):\n"
f" return {name_new_func}({str_self_dot_attributes}, {str_args_func})"
f" return {name_new_func}({str_args_pythran_func})"
"\n"
)
else:
......@@ -209,7 +214,7 @@ def produce_code_for_method(
f"\n# pythran export {name_var_code_new_method}\n"
f'\n{name_var_code_new_method} = """\n\n'
f"def new_method(self, {str_args_value_func}):\n"
f" return pythran_func({str_self_dot_attributes}, {str_args_func})"
f" return pythran_func({str_args_pythran_func})"
'\n\n"""\n'
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment