New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The helpers kwarg in autowrap method is probably broken. #10274

Closed
tokencolour opened this Issue Dec 17, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@tokencolour
Copy link
Contributor

tokencolour commented Dec 17, 2015

The helpers kwarg in autowrap method is probably broken and there are no unit tests for that.
I get the following error:

>>> from sympy.utilities.autowrap import autowrap 
>>> from sympy import Eq, symbols 
>>> x, y, z=symbols("x, y, z") 
>>> expr=(x-y+z)**(13)
>>> binary_func=autowrap(expr, language='C', backend='Cython', 
... helpers=('helper',x-y+z, (x,z,y))
 ... ) 
Traceback (most recent call last): 
File "<stdin>", line 2, in <module> 
File "/home/thd/sympy/sympy/core/cache.py", line 93, in wrapper
retval = cfunc(*args, **kwargs) 
File "/usr/lib/python3.4/functools.py", line 472, in wrapper 
result = user_function(*args, **kwds) 
File "/home/thd/sympy/sympy/utilities/autowrap.py", line 522, in autowrap 
for name, expr, args in helpers: 
ValueError: too many values to unpack (expected 3)

The args in helpers are used to call make_routine(), so the argument sequence should be tuple or a list.

@megh1241

This comment has been minimized.

Copy link
Contributor

megh1241 commented Dec 18, 2015

In the following line:
https://github.com/sympy/sympy/blob/master/sympy/utilities/autowrap.py#L522
helpers is a tuple, and one cannot iterate through a tuple of elements in that manner.
So I made helpers a list of tuples, so that the for loops won't show an error. I will add tests to this.

@moorepants moorepants closed this Dec 27, 2015

skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 16, 2016

Changes to fix helper arg in autowrap
issue sympy/sympy#10274

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>

skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 17, 2016

Changes to fix helper arg in autowrap
Closes sympy/sympy#10274

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>

skirpichev added a commit to skirpichev/diofant that referenced this issue Jul 17, 2016

Changes to fix helper arg in autowrap
Closes sympy/sympy#10274

// edited by skirpichev

Signed-off-by: Sergey B Kirpichev <skirpichev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment