PythonElementClassLookup throws error when reaches comments

Bug #1722776 reported by david greisen
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

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()

el = et.fromstring('<a><!-- hello world --></a>', parser)
# 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

david greisen (dgreisen)
description: updated
Revision history for this message
scoder (scoder) wrote :
Changed in lxml:
assignee: nobody → scoder (scoder)
importance: Undecided → Low
status: New → Fix Committed
scoder (scoder)
Changed in lxml:
milestone: none → 4.1.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.