[NumPy-Tickets] [NumPy] #1533: no error for poor spelling in pyf file

NumPy Trac numpy-tickets@scipy....
Fri Jul 2 10:38:30 CDT 2010

#1533: no error for poor spelling in pyf file
 Reporter:  samtygier   |       Owner:  pearu
     Type:  defect      |      Status:  new  
 Priority:  normal      |   Milestone:  2.0.0
Component:  numpy.f2py  |     Version:  1.3.0
 Keywords:              |  
 it took me a while to figure out why the doubles i was passing to c where
 arriving as 0. it turned out that i has miss spelt "double precision" in
 the pyf file. there was no warning given for this.

 here is an example
 #include <stdio.h>
 void di(int a, int b, double c, double d){
         printf("c: a=%d\n", a);
         printf("c: b=%d\n", b);
         printf("c: c=%f\n", c);
         printf("c: d=%f\n", d);

 python module di
 !void foo(int a, int b, double c, double d){
   subroutine di(a,b,c,d)
     intent(c) di

         integer intent(in) :: a
         integer intent(in) :: b
         double precission intent(in) :: c
         double precision intent(in) :: d
   end subroutine di
 end interface
 end python module di

 and the debug output when i run it

 >>> import di; di.di(1,2,3,4)
 debug-capi:Python C/API function di.di(a,b,c,d)
 debug-capi:int a=:input,required,scalar
 debug-capi:float c=:input,required,scalar
 debug-capi:int b=:input,required,scalar
 debug-capi:double d=:input,required,scalar
 debug-capi:Fortran subroutine `di(a,b,c,d)'
 c: a=1
 c: b=2
 c: c=0.000000
 c: d=4.000000
 debug-capi:Building return value.
 debug-capi:Python C/API function di.di: successful.
 debug-capi:Freeing memory.

 This ought to give an error when calling f2py.

 i found this with numpy 1.3, but a quick test with 1.4.1 seems to still
 have it.

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

More information about the NumPy-Tickets mailing list