Launchpad

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.PythonElemen tClassLookup) :
    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. _collectChildre n (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. _ReadOnlyElemen tProxy

Read the original on bugs.launchpad.net ↗