I have a cdef function returning an (int, int) tuple. I need to propagate exceptions and must therefore specify a return type for exceptions. Since my function never returns negative values, this could e.g. be (-1, -1). With the standard syntax specified in the documentation, my function would then look like
cdef (int, int) myFunction(int arg) except (-1, -1):
...
However, when cythonizing the above function, I get the error
Not allowed in a constant expression
I am aware that I could just turn on looking for exceptions after every function call via
cdef (int, int) myFunction(int arg) except *:
...
but this seems inefficient to me.
How can I propagate exceptions for functions with multiple return values?