Hi, it seems to be impossible to use anything but a single word as a template type for functions.
Classes don't suffer from this issue, as seen below.
As a workaround, complex types can be ctypedef-d to a single word (also
seen below).
$ cat t10.pyx
cdef extern from "nope.h":
cdef cppclass bar[T]:
void func(T arg)
void foo[T](T arg)
ctypedef char * charptr
def test():
# works
cdef bar[char *] barobj
barobj.func(NULL)
# works
foo[int](5)
# works
foo[charptr](NULL)
# fails
foo[char *](NULL)
$ cython --cplus t10.pyx
Error compiling Cython file:
------------------------------------------------------------
...
# works
foo[charptr](NULL)
# fails
foo[char *](NULL)
^
------------------------------------------------------------
t10.pyx:27:14: Expected an identifier or literal
Happy debugging,
~ mic_e
signature.asc
Description: OpenPGP digital signature
_______________________________________________ cython-devel mailing list [email protected] https://mail.python.org/mailman/listinfo/cython-devel
