[Cython] cpdef wrapping of char* functions

Robert Bradshaw robertwb at math.washington.edu
Wed Mar 19 06:07:41 CET 2008


Yes, this should work. I'll look into what's going wrong (cpdef at  
the module level is rather new, but I wasn't expecting surprises like  
this).

- Robert


On Mar 18, 2008, at 10:04 PM, Jim Kleckner wrote:

> I tried some wrapping of a function that returns a char* by
> using cpdef and got an error:
>
>    File "/usr/lib/python2.5/site-packages/Cython/Compiler/Nodes.py",
> line 897, in call_self_node
>      cfunc = ExprNodes.NameNode(self.pos,  
> name=self.declarator.base.name)
> AttributeError: CFuncDeclaratorNode instance has no attribute 'name'
>
> Should this work?
> It might be because it is at the module level and not in a class  
> perhaps?
>
> This is using 9.6.12.
>
>
> Test case:
>
> cdef extern from "foo.h":
>      cdef     int     c_baz "baz"()
>      cdef     char*   c_bar "bar"()
>
> cpdef int baz():
>      return c_baz()
>
> cpdef char* bar():
>      return c_bar()
>
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev



More information about the Cython-dev mailing list