• Nathaniel J. Smith's avatar
    Clean up the declaration of constants in numpy.pxd. · 4f34c911
    Nathaniel J. Smith authored
    There are a large number of constants declared with 'cdef enum' in
    numpy.pxd. Most of them did not correctly match the definitions in the
    numpy headers -- either because of a missing 'ctypedef', or because
    numpy.pxd claimed that they were of a named enum type ('enum
    requirements') which did not actually exist.
    
    Somewhere between Cython 0.12.1 and 0.14.1, the latter issue broke my
    compile whenever I referred to np.NPY_F_CONTIGUOUS. Cython started
    generating code like:
      enum requirements __pyx_t_10 = NPY_F_CONTIGUOUS;
      PyArray_NewFromDescr(..., __pyx_t_10, ....);
    Since there is, in fact, no such thing as 'enum requirements', the C
    compiler objected. (In earlier version, no temporary variable was
    generated, so we got away with the incorrect declaration.)
    
    And since I had to fix the declaration of this particular enum, I
    figured I might as well double-check the rest as well, in case of
    similar problems arising in the future.
    
    With this patch, Cython can once again compile scikits.sparse v0.1.
    4f34c911
numpy.pxd 34.4 KB