dhermes / bezier

Helper for Bézier Curves, Triangles, and Higher Order Objects
Apache License 2.0
266 stars 36 forks source link

Upgrade to NumPy 2.0 #319

Closed dhermes closed 5 months ago

dhermes commented 5 months ago

Note that https://github.com/cython/cython/blob/3.0.10/Cython/Includes/numpy/__init__.pxd still exists in latest Cython (3.0.10) but it's gone from the mainline branch: https://github.com/cython/cython/commits/master/Cython/Includes/numpy/__init__.pxd

But with NumPy 2.0, there is a problem with:

    /* "Cython/Includes/numpy/__init__.pxd":796
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

In particular:

...
      src/python/bezier/_speedup.c:20608:39: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘subarray’
      20608 |     __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
            |                                       ^~
...
      src/python/bezier/_speedup.c:20609:36: error: ‘PyArray_Descr’ {aka ‘struct _PyArray_Descr’} has no member named ‘subarray’
      20609 |     __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
            |                                    ^~