[main] Add Cython3 support (still support Cytnon 0.29) #1571
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch addressed issues with Cython3. The patch does not break Cython 0.29 compatibility.
Cython3 became the stock package on Ubuntu 24.04. The change in Cython language policy requires explicit
except
directive on the C function pointer type; otherwise, the function pointer type was assumednoexcept
but the actual function implementations withoutexcept
directive is assumedexcept *
, making them not able to be assigned as callback functions.In addition, Cython 3.0.8 (stock package on Ubuntu 24.04) has Enum generation bug (multiple declarations of same Enum). When
ldms_xprt_event_type type
enum type is explicitly referred to inldms_xprt_event
struct, Cython 3.0.8 somehow generated the same Enum "type_to_py" functions twice -- leading to compilation error. By declaring thetype
field asint type
, the redundant "type_to_py" functions of the same enum disappeared. The fix for this particular Cython3 bug was fixed in Cython 3.0.9(cython/cython#5905). Since Ubuntu 24.04 shipped with Cython 3.0.8, I think we have to stick with this work-around for now.