Closed
Description
Issue with current documentation:
Consider the following examples from the F2PY tests.
! hiworld.f90
function hi
print*, "Hello World"
end function
c foo77.f
function t0(value)
real value
real t0
t0 = value
end
function t4(value)
real*4 value
real*4 t4
t4 = value
end
subroutine s0(t0,value)
real value
real t0
cf2py intent(out) t0
t0 = value
end
Now consider what this is supposed to generate:
f2py -m test foo77.f only: td s0 : hiworld.f90 > out 2>error
From the documentation:
f2py [<options>] <fortran files> [[[only:]||[skip:]] \\
<fortran functions> ] \\
[: <fortran files> ...]
only: Use only fortran functions that follow until `:'.
: Get back to <fortran files> mode.
What should happen, as I understand, is that three functions should be wrapped, td, s0, hi
. However what comes through is:
Reading fortran codes...
Reading file 'foo77.f' (format:fix,strict)
Reading file '../cli/hiworld.f90' (format:free)
Post-processing...
Block: test
Block: td
Block: s0
Post-processing (stage 2)...
Building modules...
Building module "test"...
Creating wrapper for Fortran function "td"("td")...
Constructing wrapper function "td"...
td = td(value)
Constructing wrapper function "s0"...
t0 = s0(value)
Wrote C/API module "test" to file "./testmodule.c"
Fortran 77 wrappers are saved to "./test-f2pywrappers.f"
Essentially, only the functions passed in the only:
keyword are actually wrapped. This means that :
is being ignored, and is a bug.
Idea or request for content:
Personally, though this behaviour is incorrect, and can be fixed in the newer CLI, I'm more of the opinion that for the current f2py2e
a documentation change should suffice.