y=np.ones([n,n])
x=2*np.ones([n,n])
z=1
out=np.ones_like(x)
@hope.jit
def hope_exp(X,Y,Z,A):
A[:] = hope.exp((X**2+Y**2)/Z)
hope_exp(x,y,z,out)
AttributeError Traceback (most recent call last)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in visit_Assign(self, node)
286
--> 287 target, value = self.visit(node.targets[0]), self.visit(node.value)
288
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in visit_Call(self, node)
577 elif isinstance(node.func, ast.Attribute):
--> 578 if not node.starargs is None or not node.kwargs is None:
579 raise UnsupportedFeatureException("Only arguments without default values are supported in calls")
AttributeError: 'Call' object has no attribute 'starargs'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in body_visit(self, stmts)
641 try:
--> 642 self.exprs.append(self.visit(stmt))
643 except Exception as ex:
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in visit_Assign(self, node)
318 from hope._tosource import tosource
--> 319 ex.args = ((ex.args[0] if ex.args else "") + "\nin line " + tosource(node),) + ex.args[1:]
320 raise
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in tosource(node, indent_with, add_line_information)
77 generator = SourceGenerator(indent_with, add_line_information)
---> 78 generator.visit(node)
79
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in visit_Assign(self, node)
173 self.write(' = ')
--> 174 self.visit(node.value)
175
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in visit_Call(self, node)
440 self.visit(keyword.value)
--> 441 if node.starargs is not None:
442 write_comma()
AttributeError: 'Call' object has no attribute 'starargs'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
in ()
9 def hope_exp(X,Y,Z,A):
10 A[:] = hope.exp((X2+Y2)/Z)
---> 11 hope_exp(x,y,z,out)
12 np.exp((x2 + y2)/z)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_wrapper.py in _hope_callback(*args)
69
70 def _hope_callback(*args):
---> 71 return self(*args) if self.cache is None else self.cache(*args)
72 self.callback = _hope_callback
73 setattr(cache, str(id(self.callback)), fkt)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_wrapper.py in call(self, *args)
75
76 def call(self, *args):
---> 77 ASTTransformer(self.modtoken).module_visit(self.fkt, args)
78
79 if config.optimize:
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in module_visit(self, fkt, args, argid)
690 if argid is None or not argid in self.modtoken.functions[fkt.name]:
691 #Create the HOPE AST from the builtin AST
--> 692 parsed = self.visit(fktast)
693 if not parsed.getId() in [arg.getId() for arg in self.modtoken.functions[fkt.name]]:
694 self.modtoken.functions[fkt.name].append(parsed)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
251 method = 'visit_' + node.class.name
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
255 def generic_visit(self, node):
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in visit_FunctionDef(self, node)
627
628 # TODO: how do we parse recursive subfuncitons?
--> 629 self.token.body = self.body_visit(node.body)
630 AllocateVisitor(self.variables).visit(self.token.body)
631 merged = {}
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_transformer.py in body_visit(self, stmts)
644 if "\nin body " not in (ex.args[0] if ex.args else ""):
645 from hope._tosource import tosource
--> 646 ex.args = ((ex.args[0] if ex.args else "") + "\nin body " + tosource(stmt),) + ex.args[1:]
647 raise
648 for expr in self.exprs:
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in tosource(node, indent_with, add_line_information)
76
77 generator = SourceGenerator(indent_with, add_line_information)
---> 78 generator.visit(node)
79
80 return ''.join(generator.result)
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
251 method = 'visit_' + node.class.name
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
255 def generic_visit(self, node):
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in visit_Assign(self, node)
172 self.visit(target)
173 self.write(' = ')
--> 174 self.visit(node.value)
175
176 def visit_AugAssign(self, node):
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/ast.py in visit(self, node)
251 method = 'visit_' + node.class.name
252 visitor = getattr(self, method, self.generic_visit)
--> 253 return visitor(node)
254
255 def generic_visit(self, node):
/Users/edouglas/anaconda/envs/astroconda/lib/python3.6/site-packages/hope/_tosource.py in visit_Call(self, node)
439 self.write(keyword.arg + '=')
440 self.visit(keyword.value)
--> 441 if node.starargs is not None:
442 write_comma()
443 self.write('*')
AttributeError: 'Call' object has no attribute 'starargs'
Additionally, the standard sum example from the readme gives this error in 3.6.1 but works in 2.7: