Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cython: both const and except in C++ method declaration

Tags:

cython

My code is:

cdef extern from "mylib.h":
    cdef cppclass MyClass:
        MyClass(const char *data) except +
        # and I also need except + for myMethod
        int myMethod(size_t len, char *data) const

I need both const and except + for my method, but I cannot. I tried to write it after space, after comma, put both declarations in parenthes -- but got different types of cyntax errors. Documentation gave no hints about multiple annotations...

cython 0.20.1 from Ubuntu Trusty was used.

like image 649
monoid Avatar asked Oct 20 '25 02:10

monoid


1 Answers

For reference, the answer the OP seems to have got from the Cython mailing list was essentially that it is currently not possible, but that it might not matter in practice, since the const can be dropped in favour of the except + without affecting the ability to compile.

like image 145
Dologan Avatar answered Oct 22 '25 04:10

Dologan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!