On Dec 7, 2009, at 10:00 AM, Gael Varoquaux wrote: > On Mon, Dec 07, 2009 at 09:51:44AM -0800, Robert Bradshaw wrote: >>>> I have a lot of code that has stopped working with my latest SVN >>>> pull to >>>> numpy. > >>>> * Some compiled code yields an error looking like (from memory): > >>>> "incorrect type 'numpy.ndarray'" > >>>> Rebuilding it is sufficient. > >>> Is this Cython or Pyrex code? Unfortunately Pyrex checks the size of >>> types exactly such that even if you extend the type in a backwards >>> compatible way, it will raise that exception. This behavior has been >>> inherited by Cython. I have asked for this feature to be removed, or >>> at least turned into a >= check, but it got no traction. >> >> Could you better describe your usecase? You have a Cython type that >> you >> then extend from C and try to use from Cython again without >> redeclaring >> it? > > The usecase in my own code is simply to bind existing C code passing > it > the numpy array (and yes, it has to be contigous).
Maybe you could boil this down to a tiny example? > However, some scipy code displays the same problem: > > /home/varoquau/dev/scipy/scipy/stats/distributions.py in <module>() > 25 from scipy.special import gammaln as gamln > 26 from copy import copy > ---> 27 import vonmises_cython > 28 import textwrap > 29 > > /home/varoquau/Desktop/graph_francois/numpy.pxd in > scipy.stats.vonmises_cython (scipy/stats/vonmises_cython.c:2939)() > 28 > 29 > ---> 30 > 31 > 32 > > ValueError: numpy.dtype does not appear to be the correct type object > > To make sure that we are talking about the same thing, the object that > has changed, here, is the numpy array, which is independant of my > code, > or of scipy code. The problem is currenlty that when numpy changes, > even > in a backward compatible way, Cython code taking numpy arrays needs > to be > recompiled. Is there a way to detect whether the way its been changed is backward compatible? I'd rather be overly cautious. I don't think it's strange to have to recompile when a C-level dependancy changes, even if the change is compatible. I'm still a bit confused though--numpy types are declared as "extern" so I wouldn't expect their size to be checked. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
