[Numpy-discussion] f2py function callback: error while using repeated arguments in function call

Pearu Peterson pearu.peterson@gmail....
Mon Nov 9 05:23:02 CST 2009


Yves Frederix wrote:
> Hi,
> 
> I am doing a simple function callback from fortran to python for which
> the actual function call in fortran has repeated arguments.
> 
> ! callback_error.f90:
> subroutine testfun(x)
>    double precision, intent(in) :: x
>    double precision :: y
> !f2py intent(callback) foo
> !f2py double precision :: arg1
> !f2py double precision :: arg2
> !f2py double precision :: y
> !f2py external y = foo(arg1, arg2)
>    external foo
>    y = foo(x, x)     !  <-- this causes problems
>    print *, 'y:', y
> end subroutine testfun

..

> Is this expected behavior?

No. The bug is now fixed in numpy svn (rev 7712).

Thanks for pointing out this corner case.
Pearu


More information about the NumPy-Discussion mailing list