Re: [f2py] f2py bug?

Al Niessner <[email protected]> Fri, 30 Jul 2010 08:59:46 -0700
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Thanks. I fixed my local copy.

On Thu, 2010-07-29 at 20:46 -0700, Pearu Peterson wrote:
> On Thu, Jul 29, 2010 at 11:52 PM, Al Niessner <[email protected]> wrote:
> > 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.
> 
> What numpy version (numpy.__version__) are you using? numpy in svn
> does not have this problem, that is, the bug is fixed there.
> If you cannot upgrade numpy at the moment, then edit the
> numpy/f2py/cfuncs.py file by adding the semicolon to the corresponding
> line, search for the definition of long_double_from_pyobj.
> 
> Pearu
> 
> _______________________________________________
> f2py-users mailing list
> [email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users

-- 
Al Niessner
818.354.0859

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


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