[lxml-dev] Instantiated ObjectifiedElement

Evan Grim egrim at swri.org
Wed Feb 20 23:47:55 CET 2008


I've run into some curious behavior when trying to do something a bit
non-standard with objectify.  The code snippet below causes a hard crash.  I
know this isn't part of what is anticipated as normal use, but since it causes a
crash I figure it's worth bringing up here to at least get some comments.

<code>
from lxml import etree, objectify

class parent(objectify.ObjectifiedElement):
    pass

p = parent()
print p.tag
</code>

My use case here is that I'm trying to make a package that acts like objectify,
but enforces schema restrictions.  I'm trying my hand at writing custom classes
that will do this, but maintain the nice interface that objectify provides. 
Where this fails is when I try to create an instance of one of my custom classes
directly (as seen in the trivial code snippet above). 

I'm welcome to any suggestions, and at the very least wanted to bring the
seg-fault producing condition to light so that the extension can be amended to
prevent it.



More information about the lxml-dev mailing list