[Numpy-discussion] f2py function name issues

Pauli Virtanen pav@iki...
Fri Mar 9 14:29:37 CST 2012

09.03.2012 21:05, Sameer Grover kirjoitti:
> subroutine union ()
>    write(*,*)'Hello from Fortran90!!!'
> end subroutine union
> f2py is unable to wrap this function. Changing the name of the
> subroutine from 'union' to something else works. I understand that
> problems like these have been reported a long time ago
> (http://cens.ioc.ee/pipermail/f2py-users/2003-November/000605.html)
> with some other function names as well.
> This looks like a bug to me or is there something I'm missing?

f2py indeed seems to skip names that collide with C keywords. The reason
probably is that it's not guaranteed that the symbol name is mangled to
"union_" but it could also become "union". If the name matches a C
keyword, there's probably no (sane) way to call the function from the C
language, and since f2py goes through C, it's not able to call that.

Whether this is a real problem in practice or not is then a different

The full list of "bad" names is

'max', 'min', 'flen','fshape',

More information about the NumPy-Discussion mailing list