f55eb6d562
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
32 lines
1015 B
Diff
32 lines
1015 B
Diff
Use the recommended way to integrate Cython and NumPy
|
|
|
|
This follows the example code in
|
|
<https://cython.readthedocs.io/en/latest/src/tutorial/numpy.html#adding-types>.
|
|
|
|
The previous version results in an int-conversion error with current
|
|
compilers.
|
|
|
|
Submitted upstream: <https://github.com/OpenKinect/libfreenect/pull/679>
|
|
|
|
diff --git a/wrappers/python/freenect.pyx b/wrappers/python/freenect.pyx
|
|
index 5bda18b42e8243e5..f69483d4b9592daa 100644
|
|
--- a/wrappers/python/freenect.pyx
|
|
+++ b/wrappers/python/freenect.pyx
|
|
@@ -27,7 +27,6 @@ import numpy as np
|
|
cimport numpy as npc
|
|
|
|
cdef extern from "numpy/arrayobject.h":
|
|
- void import_array()
|
|
cdef object PyArray_SimpleNewFromData(int nd, npc.npy_intp *dims,
|
|
int typenum, void *data)
|
|
|
|
@@ -455,7 +454,7 @@ def base_runloop(CtxPtr ctx, body=None):
|
|
except Kill:
|
|
pass
|
|
|
|
-import_array()
|
|
+npc.import_array()
|
|
|
|
cdef object _depth_cb_np(void *data, freenect_frame_mode *mode):
|
|
cdef npc.npy_intp dims[2]
|