The project rtmidi-python compiles well on Cython 0.29.37 (the latest version before Cython 3.0), but it fails on Cython 3.0, with the error below.
Are there known incompatibilities when upgrading to Cython 3?
If so, is there a flag to use when calling Cython 3 to keep backwards compatibility with previous versions, without requiring to modify the actual .pyx file?
Error compiling Cython file:
------------------------------------------------------------
...
self.thisptr.cancelCallback()
self.py_callback = callback
if self.py_callback is not None:
self.thisptr.setCallback(midi_in_callback, <void*>self.py_callback)
^
------------------------------------------------------------
rtmidi_python.pyx:92:41: Cannot assign type 'void (double, vector[unsigned char] *, void *) except * nogil' to 'RtMidiCallback' (alias of 'void (*)(double, vector[unsigned char] *, void *) noexcept'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'midi_in_callback'.
Traceback (most recent call last):
...
If so, is there a flag to use when calling Cython 3 to keep backwards compatibility with previous versions, without requiring to modify the actual .pyx file?
legacy_implicit_noexcept
https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html
Are there known incompatibilities when upgrading to Cython 3?
Yes. Cython 3 makes a number of breaking changes. Some of the bigger ones are documented in https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html. noexcept
is probably the most significant one (both in terms of the intended change, and various unintended edge cases).