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
{{ message }}
Repository navigation
f2py parser fails on a Fortran function with C binding #9693
changed the title [-]f2py parser fails when a Fortran function with C binding[/-][+]f2py parser fails on a Fortran function with C binding[/+]on Sep 15, 2017
This is in part due to the fact that the bind(c) attribute is part of the Fortran 2003 standard and the snippet is not valid Fortran 2003. The function must be in a module that uses the iso_c_binding module. A valid minimum failing example would be:
module mfe
use iso_c_binding
implicit none
contains
function wat(x, y) result(z) bind(c, name='wat')
integer(c_int), intent(in) :: x, y
integer(c_int) :: z
z = x + 7
end function wat
end module mfe
This compiles happily with gfortran on macOS 10.12.6 However, this still throw an assertion error with NumPy 1.13.3
I get the same error in both Python 3.6 and 2.7 installed from MacPorts. I cloned the repo and managed to build tags v1.6.0 and v1.7.0 against the native Python (2.7), but I still get the error.
So, is this a user error trying to parse the source using f2py.crackfortran.crackfortran or a parer error as referenced in the closed issue? Are there any other tags where this was to have been fixed?
Update: Fixed the attributes to properly declare the types of the arguments.
Activity
[-]f2py parser fails when a Fortran function with C binding[/-][+]f2py parser fails on a Fortran function with C binding[/+]kprussing commentedon Dec 17, 2017
This is in part due to the fact that the
bind(c)attribute is part of the Fortran 2003 standard and the snippet is not valid Fortran 2003. The function must be in a module that uses theiso_c_bindingmodule. A valid minimum failing example would be:This compiles happily with gfortran on macOS 10.12.6 However, this still throw an assertion error with NumPy 1.13.3
I get the same error in both Python 3.6 and 2.7 installed from MacPorts. I cloned the repo and managed to build tags v1.6.0 and v1.7.0 against the native Python (2.7), but I still get the error.
So, is this a user error trying to parse the source using
f2py.crackfortran.crackfortranor a parer error as referenced in the closed issue? Are there any other tags where this was to have been fixed?Update: Fixed the attributes to properly declare the types of the arguments.