Skip to content

Commit a9806d3

Browse files
committed
fix(python): use legacy_implicit_noexcept to support old cython and fix #680
Signed-off-by: Benn Snyder <[email protected]>
1 parent 5341ff6 commit a9806d3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ include (SetupDirectories)
4747

4848
set (PROJECT_VER_MAJOR 0)
4949
set (PROJECT_VER_MINOR 7)
50-
set (PROJECT_VER_PATCH 1)
50+
set (PROJECT_VER_PATCH 2)
5151
set (PROJECT_VER
5252
"${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
5353
set (PROJECT_APIVER

wrappers/python/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ add_custom_command(OUTPUT freenect${Python_BUILD_VERSION}.c
3737
${CYTHON_EXECUTABLE}
3838
-${Python_BUILD_VERSION}
3939
-o freenect${Python_BUILD_VERSION}.c
40+
# cython 3.0 needs certain functions to be marked noexcept
41+
# but noexcept is not defined in old cython shipped in ubuntu 20.04
42+
# todo: eventually require cython >= 0.29.31 and add proper noexcept without this workaround
43+
-X legacy_implicit_noexcept=True
4044
"${CMAKE_CURRENT_SOURCE_DIR}/freenect.pyx")
4145
list(APPEND ADDITIONAL_MAKE_CLEAN_FILES freenect${Python_BUILD_VERSION}.c)
4246

wrappers/python/freenect.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ cpdef open_device(CtxPtr ctx, int index):
322322

323323
_depth_cb, _video_cb = None, None
324324

325-
cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) noexcept with gil:
325+
cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil:
326326
cdef freenect_frame_mode mode = freenect_get_current_depth_mode(dev)
327327
if not mode.is_valid:
328328
return
@@ -333,7 +333,7 @@ cdef void depth_cb(freenect_device *dev, void *data, uint32_t timestamp) noexcep
333333
pydata = _depth_cb_np(data, &mode)
334334
_depth_cb(dev_out, pydata, timestamp)
335335

336-
cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) noexcept with gil:
336+
cdef void video_cb(freenect_device *dev, void *data, uint32_t timestamp) with gil:
337337
cdef freenect_frame_mode mode = freenect_get_current_video_mode(dev)
338338
if not mode.is_valid:
339339
return

0 commit comments

Comments
 (0)