Because Cython 3.0 was released at last, I tried to compile raysect with it, and encountered some cython compile issues.
They seems to be related to both kdtree2d.pyx and kdtree3d.pyx, and the result when compiled the latter module are shown as follows:
❯ cython kdtree3d.pyx
warning: /home/koyo/Documents/raysect/source/raysect/core/math/sampler/solidangle.pxd:37:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: /home/koyo/Documents/raysect/source/raysect/core/math/sampler/solidangle.pxd:38:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:44:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:47:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:50:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:51:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:52:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
warning: kdtree3d.pyx:53:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
Error compiling Cython file:
------------------------------------------------------------
...
# upper edge
edges[upper_index].is_upper_edge = True
edges[upper_index].value = item.box.upper.get_index(axis)
# sort
qsort(<void *> edges, count, sizeof(edge), _edge_compare)
^
------------------------------------------------------------
kdtree3d.pyx:344:51: Cannot assign type 'int (const void *, const void *) except? -1 nogil' to 'int (*)(const void *, const void *) noexcept nogil'
According the above error message, I added noexcept at _edge_compare in both kdtree*d.pyx file like:
cdef int _edge_compare(const void *p1, const void *p2) noexcept nogil:
This change seems to resolve the issue.
So, please consider my fix for cython 3.0 compilation.
Hello!
Because Cython 3.0 was released at last, I tried to compile
raysect
with it, and encountered some cython compile issues. They seems to be related to bothkdtree2d.pyx
andkdtree3d.pyx
, and the result when compiled the latter module are shown as follows:According the above error message, I added
noexcept
at_edge_compare
in bothkdtree*d.pyx
file like:This change seems to resolve the issue. So, please consider my fix for cython 3.0 compilation.
package version I tired to compile
Python
3.10.12Cython
3.0.0