[lxml-dev] objectify __setattr__/addattr bug

Hi, funny how s.th. like this could go undetected in all lxml.objectify versions: python2.4 -i -c 'from lxml import etree, objectify; objectify.enable_recursive_str(); print etree.__version__; print etree.LIBXML_VERSION, etree.LIBXSLT_VERSION; root=objectify.Element("root")' 2.2.2 (2, 6, 32) (1, 1, 23)
So while the assignment (string) rvalue is unacceptable an element gets created nonetheless; I'd say this is a bug. This fixes it: $ svn diff Index: src/lxml/lxml.objectify.pyx =================================================================== --- src/lxml/lxml.objectify.pyx (revision 67827) +++ src/lxml/lxml.objectify.pyx (working copy) @@ -523,9 +523,10 @@ for item in value: _appendValue(parent, tag, item) else: - new_element = cetree.makeSubElement( - parent, tag, None, None, None, None) + new_element = cetree.makeElement( + tag, parent._doc, None, None, None, None, None) _setElementValue(new_element, value) + cetree.appendChild(parent, new_element) cdef _setElementValue(_Element element, value): cdef python.PyObject* _pytype Add some test(s) and check it in? Holger -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Hi,
Done: https://codespeak.net/viewvc/?view=rev&revision=67943 As the testcases need to use unicode data: I'm pretty sure I did not break anything for Py3; I used the helper functions from common_imports but can't currently really test this due to lack of a working Py3 environment. Holger -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Hi,
Done: https://codespeak.net/viewvc/?view=rev&revision=67943 As the testcases need to use unicode data: I'm pretty sure I did not break anything for Py3; I used the helper functions from common_imports but can't currently really test this due to lack of a working Py3 environment. Holger -- GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
participants (2)
-
jholg@gmx.de
-
Stefan Behnel