[NumPy-Tickets] [NumPy] #437: Updates to f2py callbacks desired

NumPy Trac numpy-tickets@scipy....
Thu Mar 24 15:48:42 CDT 2011


#437: Updates to f2py callbacks desired
--------------------------+-------------------------------------------------
  Reporter:  mesmith      |       Owner:  pearu                               
      Type:  enhancement  |      Status:  closed                              
  Priority:  high         |   Milestone:                                      
 Component:  numpy.f2py   |     Version:                                      
Resolution:  wontfix      |    Keywords:  f2py cb_rules crackfortran callbacks
--------------------------+-------------------------------------------------
Changes (by pearu):

  * status:  reopened => closed
  * resolution:  => wontfix


Comment:

 The issue is resolved when changing the line
 {{{
 cf2py  intent(callback, hide) py_errmsg
 }}}
 to
 {{{
 cf2py  intent(callback) py_errmsg
 }}}
 Note that using optional and intent(hide) for the same argument is
 contradictory.

 So, the provided example with intent(hide) removed
 {{{
 c file fortran.f
       subroutine f1()
 cf2py    intent(callback) fpy
 cf2py    optional fpy
 cf2py    external fpy
 cf2py    use f2__user__routines
          print *, "in f1"
          call f2()
          call f2()
          return
       end

       subroutine f2()
 cf2py    intent(callback) fpy
 cf2py    optional fpy
 cf2py    external fpy
          print *, "in f2"
          call fpy()
          return
       end
 }}}

 works as expected:
 {{{
 f2py -c fortran.f -m foo

 >>> import foo
 >>> def bar(): print 'fpy bar'
 ...
 >>> def bar2(): print 'fpy bar2'
 ...
 >>> foo.fpy = bar
 >>> foo.f2()
  in f2
 fpy bar
 >>> foo.f2(bar2)
  in f2
 fpy bar2
 >>> foo.f1()
  in f1
  in f2
 fpy bar
  in f2
 fpy bar
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/437#comment:8>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list