an xpath parsing error

Bug #2069593 reported by wqr
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
New
Undecided
Unassigned

Bug Description

from lxml.html import fromstring, tostring

html_text = """
<i><p>123</p></i>
"""

root = fromstring(html_text)
p_s = root.xpath('//i/p')

for p in p_s:
    print(tostring(p))

--------------------------

This code should output b'<p>123</p>' (if using the etree module instead of the html module, it will output correctly), but in reality, there is no output. And what's confusing is that this problem seems to only appear on the p tag under the i tag.

versions:
python: 3.10.12
lxml: 5.2.2
libxml: 2.12.6
libxslt: 1.1.39

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.