[f2py] f2py bug?

Al Niessner <[email protected]> Thu, 29 Jul 2010 13:52:19 -0700
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
I do a 'f2py -c a.f90 b.f90 c.f90 x.f -m x' and it plows away for a
while and then has the following error:

gcc: /tmp/tmp4DtGEi/src.linux-x86_64-2.6/xmodule.c
/tmp/tmp4DtGEi/src.linux-x86_64-2.6/xmodule.c: In function
‘long_double_from_pyobj’:
/tmp/tmp4DtGEi/src.linux-x86_64-2.6/xmodule.c:335: error: expected ‘;’
before ‘return’
/tmp/tmp4DtGEi/src.linux-x86_64-2.6/xmodule.c: In function
‘long_double_from_pyobj’:
/tmp/tmp4DtGEi/src.linux-x86_64-2.6/xmodule.c:335: error: expected ‘;’
before ‘return’

Here is the offending code:

static int long_double_from_pyobj(long_double* v,PyObject *obj,const
char *errmess) {
  double d=0;
  if (PyArray_CheckScalar(obj)){
    if PyArray_IsScalar(obj, LongDouble) {
      PyArray_ScalarAsCtype(obj, v);
      return 1;
    }
    else if (PyArray_Check(obj) &&
PyArray_TYPE(obj)==PyArray_LONGDOUBLE) {
      (*v) = *((npy_longdouble *)PyArray_DATA(obj))
      return 1;
    }
  }
  if (double_from_pyobj(&d,obj,errmess)) {
    *v = (long_double)d;
    return 1;
  }
  return 0;
}

where line 335 is:
(*v) = *((npy_longdouble *)PyArray_DATA(obj))

I attach a ; at the end of that line and compile it by hand and it
works. So, it seems like whatever generated this missed a semicolon. Is
this known and is there is a fix? I looked through some of the archive
but did not see anything nor did I find anything useful from the
obligatory google search.

While the problem is easy to understand, it is very unclear to me how to
fix it or work around it. I can compile it by hand but I cannot get f2py
to pick up where it left off. I have not looked at the code generator to
fix it, but that does not sound easy either. Any other ideas?

Thanks for any and all help in advance.

-- 
Al Niessner
818.354.0859

--------
|  dS  | >= 0
--------



_______________________________________________
f2py-users mailing list
[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users