carriage return differs in tree copy

Bug #1562550 reported by Thomas Steinacher
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Confirmed
Undecided
Unassigned

Bug Description

OS X 10.11.4
Python : sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
lxml.etree : (3, 6, 0, 0)
libxml used : (2, 9, 2)
libxml compiled : (2, 9, 2)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)

After copying the LXML tree with copy.copy (or copy.deepcopy), I am getting a tree that renders differently. I would expect both trees to render the same way.

In [1]: import lxml.html

In [2]: import copy

In [3]: tree = lxml.html.fromstring('<div>\r</div>')

In [4]: lxml.html.tostring(tree)
Out[4]: '<div>\r</div>'

In [5]: lxml.html.tostring(copy.copy(tree))
Out[5]: '<div>&#13;</div>'

Revision history for this message
scoder (scoder) wrote :

Yes, that seems wrong. Might be an issue with the configuration of the underlying "xmlDoc", probably with the document encoding that it specifies.
PR welcome.

Changed in lxml:
status: New → Confirmed
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.