Comment 0 for bug 1722776

Revision history for this message
david greisen (dgreisen) wrote :

Python : sys.version_info(major=3, minor=6, micro=2, releaselevel='final', serial=0)
lxml.etree : (4, 0, 0, 0)
libxml used : (2, 9, 5)
libxml compiled : (2, 9, 5)
libxslt used : (1, 1, 30)

To reproduce:

import lxml.etree as et
class MyLookup(et.PythonElementClassLookup):
    def lookup(self, document, element):
        return None

parser = et.XMLParser()
parser.set_element_class_lookup(MyLookup())

el = et.fromstring('<a><!-- hello world --></a>', parser)
el.getchildren()
  File "<stdin>", line 1, in <module>
  File "src/lxml/lxml.etree.pyx", line 1351, in lxml.etree._Element.getchildren (src/lxml/lxml.etree.c:57046)
  File "src/lxml/apihelpers.pxi", line 805, in lxml.etree._collectChildren (src/lxml/lxml.etree.c:25788)
  File "src/lxml/lxml.etree.pyx", line 1617, in lxml.etree._elementFactory (src/lxml/lxml.etree.c:60167)
  File "src/lxml/classlookup.pxi", line 405, in lxml.etree._parser_class_lookup (src/lxml/lxml.etree.c:93219)
  File "src/lxml/classlookup.pxi", line 526, in lxml.etree._python_class_lookup (src/lxml/lxml.etree.c:94017)
TypeError: Cannot convert lxml.etree._ReadOnlyProxy to lxml.etree._ReadOnlyElementProxy