Ticket #567 (new defect)

Opened 4 years ago

super doesn't work with cpdef methods

Reported by: robertwb Owned by: somebody
Priority: major Milestone: wishlist
Component: Code Generation Keywords:
Cc:

Description

On Thu, Aug 12, 2010 at 1:32 PM, Ken wrote:

> Having a bit of a problem with the super keyword in cpdef functions.
> It works for __init__ and friends, but not this:
>
> cdef class A:
>    cpdef foo(self):
>        print "Foo"
>
> cdef class B(A):
>    cpdef foo(self):
>        super(B,self).foo()
>        print "Bar"
>
> cdef class C(B):
>    cpdef foo(self):
>        super(C,self).foo()
>        print "Plugh"
>
> Calling foo from C results in an infinite recursion between B.foo and
> C.foo.
> If this were python code (and A extended object), this would work.
> Making A extend object doesn't help in the cython code. Changing
> super(C,self).foo() to B.foo(self) and super(B,self).foo() to
> A.foo(self) makes it work.
Note: See TracTickets for help on using tickets.