Hi,

Kay Schluehr wrote:
> 
> cdef class ExtPoint:
>     cdef int x
>     cdef int y
> 
>     cdef convert(self, CPoint pt): 
>         self.x = pt.x
>         self.y = pt.y
> 
> cpdef test():
>     cdef CPoint pt
>     pt.x = random.randrange(100)
>     pt.y = random.randrange(100)
>     ep = ExtPoint()
>     convert(ep, pt)    # o.k   - compiles
>     ep.convert(pt)     # n.o.k - fails to compile

You forgot to

        cdef ExtPoint ep

so that Cython knows that ep.convert() even exists as a C method.
Otherwise, it considers it a Python method on an unknown Python object.

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to