[Pyrex] C-API implementation in Pyrex 0.9.6

Stefan Behnel stefan_ml at behnel.de
Mon Oct 15 19:23:42 CEST 2007


Greg Ewing wrote:
> #------------------------------------------------------------
> # etree.pxd
> #------------------------------------------------------------
> 
> cimport tree
> 
> cdef class _BaseParser
> 
> cdef public class _Document [type LxmlDocumentType, object LxmlDocument]:
>   cdef tree.xmlDoc *_c_doc
>   cdef _BaseParser _parser
> 
> cdef public class _Element [type LxmlElementType, object LxmlElement]:
>   cdef _Document _doc
>   cdef tree.xmlNode *_c_node
> 
> cdef object getAttributeValue(_Element element, key, default)
> 
> #------------------------------------------------------------
> # etree.pyx
> #------------------------------------------------------------
> 
> cdef public class _Document [type LxmlDocumentType, object LxmlDocument]:
>   pass
> 
> cdef public class _Element [type LxmlElementType, object LxmlElement]:
>     pass

When I add C methods to these, I get errors that they are "not previously
declared in definition part of extension type". I hope that's a bug and not a
feature?

Stefan




More information about the Pyrex mailing list