Skip to content

Commit 933c4ed

Browse files
committed
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: …-build/wrappers/python/freenect3.c:16598:3: error: returning ‘void *’ from a function with return type ‘int’ makes integer from pointer without a cast 16598 | import_array(); | ^~~~~~~~~~~~
1 parent 5341ff6 commit 933c4ed

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

wrappers/python/freenect.pyx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import numpy as np
2727
cimport numpy as npc
2828

2929
cdef extern from "numpy/arrayobject.h":
30-
void import_array()
3130
cdef object PyArray_SimpleNewFromData(int nd, npc.npy_intp *dims,
3231
int typenum, void *data)
3332

@@ -455,7 +454,7 @@ def base_runloop(CtxPtr ctx, body=None):
455454
except Kill:
456455
pass
457456

458-
import_array()
457+
npc.import_array()
459458

460459
cdef object _depth_cb_np(void *data, freenect_frame_mode *mode):
461460
cdef npc.npy_intp dims[2]

0 commit comments

Comments
 (0)