[NumPy-Tickets] [NumPy] #1954: f2py: --no-lower does not work in one-step compilation

NumPy Trac numpy-tickets@scipy....
Mon Sep 26 06:51:45 CDT 2011


#1954: f2py: --no-lower does not work in one-step compilation
------------------------+---------------------------------------------------
 Reporter:  azrael      |       Owner:  pearu      
     Type:  defect      |      Status:  new        
 Priority:  normal      |   Milestone:  Unscheduled
Component:  numpy.f2py  |     Version:  1.3.0      
 Keywords:  f2py        |  
------------------------+---------------------------------------------------
 In order to impliment exception handling for Fortran errors into a f2py
 wrapped function, I followed this advice:

 [http://mail.scipy.org/pipermail/numpy-
 discussion/2009-January/039672.html]

 I wanted this to work without editing the .pyf file, and got that by
 adding the following to the Fortran code:

 {{{
 !f2py callstatement (*f2py_func)( ... ); if (ierr == 1)
 PyErr_SetString(PyExc_ValueError, "msg")
 !f2py callprotoargument ...
 }}}

 (The ... is just a replacement for actual code)

 When I tried to compile this with

 {{{
 f2py -c -m m src.f
 }}}

 I got several warnings/errors like this

 {{{
 warning: implicit declaration of function ‘pyerr_setstring’
 }}}

 Obviously the case-lowering acted on this line. As far as I understand the
 User Guide this should not happen, since I didn't call f2py with '-h' or '
 --lower'. Nevertheless I added the '--no-lower', but still got the same
 warnings/errors.

 Then I tried whether the added line will show up in the .pyf correctly,
 which it did, when I used '--no-lower' like this:

 {{{
 f2py --no-lower -m m -h m.pyf src.f
 }}}

 After generating the .pyf I can compile the module - '''without''' further
 editing in the .pyf!

 {{{
 f2py -c m.pyf src.f
 }}}


 ----


 1. Is this intended behaviour? Should it make a difference whether I
 generate the .pyf first and then compile or use the one-step way?

 2. Is there a way to circumvent using "callprotoargument"? I'd much rather
 have f2py do it's magic to guess the first line in callstatement and the
 callprotoargument, and then just add my piece of extra code. Can this be
 done? Something like a 'addtocallstatement' directive comes to mind ...

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1954>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list