You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there is an incompatibility between functions with default parameter values and pythran specifications. Here is an example:
#pythran export F(int, float, str)
def F(a=1, b=2.0, c='hello'):
print ('a:', a, 'b:', b, 'c:', c)
from _default import F
In [23]: F()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[23], line 1
----> 1 F()
TypeError: Invalid call to pythranized function `F()'
Candidates are:
- F(int, float, str)
In python, any combination of values could be specified or omitted:
F(a=1)
F(b=2.5)
F(b=3.0, c='bye')
There would appear to be no way to capture this in
pythran_export specifications.
For now, my workaround is write python wrapper functions that interpret the passed parameters and defaults and then call the pythran function with all parameters passed.
def wrap_F (a=1, b=2.0, c='hello'):
return F(a, b, c)
But this is not ideal
At least it would be better if somehow the wrapper function could be included in the same source file instead of needing a 2nd source file for the wrapper.
The text was updated successfully, but these errors were encountered:
I think there is an incompatibility between functions with default parameter values and pythran specifications. Here is an example:
In python, any combination of values could be specified or omitted:
F(a=1)
F(b=2.5)
F(b=3.0, c='bye')
There would appear to be no way to capture this in
pythran_export specifications.
For now, my workaround is write python wrapper functions that interpret the passed parameters and defaults and then call the pythran function with all parameters passed.
But this is not ideal
At least it would be better if somehow the wrapper function could be included in the same source file instead of needing a 2nd source file for the wrapper.
The text was updated successfully, but these errors were encountered: