[Cython] Bug: compilation failure with "Template parameter not a type" for pointer & reference types

Yury V. Zaytsev yury at shurup.com
Wed Feb 10 05:59:40 EST 2016


On Wed, 10 Feb 2016, Yury V. Zaytsev wrote:

> If the return type of a function is a normal type, then everything is 
> fine, but if it's a pointer or reference type, then Cython refuses to 
> compile it.

I've just found out that apparently this happens because Cython misparses 
function definition as an array declaration, but luckily a safety check 
kicks in.

An obvious workaround is:

     ctypedef char* r1
     ctypedef char& r2

     cdef extern from * nogil:
         cdef cppclass test:
             r1 assign[input_iterator](input_iterator, input_iterator)
             r2 assign[input_iterator](input_iterator, input_iterator)

which compiles just fine. Unfortunately, I'm not well-versed enough with 
the parser to provide a patch...

Hope that helps to fix the problem for good though!

-- 
Sincerely yours,
Yury V. Zaytsev


More information about the cython-devel mailing list