Message315428
The _serialize_xml function in ElementTree.py doesn't escape Comment.text values when writing output. This means the following code:
import sys
import xml.etree.ElementTree
elem = xml.etree.ElementTree.Comment()
elem.text = 'hi --> bye'
tree = xml.etree.ElementTree.ElementTree(elem)
tree.write(sys.stdout)
...will output the following invalid xml:
<!--hi --> bye-->
In Python 3.7, changing the _serialize_xml function on line 903/904 from this:
if tag is Comment:
write("<!--%s-->" % text)
...to this:
if tag is Comment:
write("<!--%s-->" % _escape_cdata(text))
...writes something more expected:
<!--hi --> bye--> |
|
Date |
User |
Action |
Args |
2018-04-18 00:33:12 | johnburnett | set | recipients:
+ johnburnett, scoder, eli.bendersky |
2018-04-18 00:33:12 | johnburnett | set | messageid: <1524011592.66.0.682650639539.issue33303@psf.upfronthosting.co.za> |
2018-04-18 00:33:12 | johnburnett | link | issue33303 messages |
2018-04-18 00:33:11 | johnburnett | create | |
|