[Cython] overriding cpdef methods
Stefan Behnel
stefan_ml at behnel.de
Tue Dec 23 08:43:23 CET 2008
Hi,
while cythonising Visitor.py with an external .pxd, I noticed that I can't
currently override a cpdef method in a subtype. The hierarchy is like this:
--------------------
cdef class BasicVisitor:
cdef dict dispatch_table
cpdef visit(self, obj)
cdef class TreeVisitor(BasicVisitor):
cdef public list access_path
cpdef visitchild(self, child, parent, attrname, idx)
cpdef visitchildren(self, parent, attrs=*) # <-----
cdef class VisitorTransform(TreeVisitor):
cdef object _super_visitchildren
cpdef visitchildren(self, parent, attrs=*) # <-----
cpdef recurse_to_children(self, node)
--------------------
and the error I get out of Symtab.py is:
------------------------------------------------------------
...
def visitchildren(self, parent, attrs=None):
^
------------------------------------------------------------
.../Cython/Compiler/Visitor.py:150:4: Self argument of C method does not
match parent type
Does anyone know if this is an anticipated problem, or just a bug that
needs fixing? I don't see any general obstacles for overriding cpdef methods.
Stefan
More information about the Cython-dev
mailing list