Message315428
| Author | johnburnett |
|---|---|
| Recipients | eli.bendersky, johnburnett, scoder |
| Date | 2018-04-18.00:33:11 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1524011592.66.0.682650639539.issue33303@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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--> |
|
| History | |||
|---|---|---|---|
| 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 | |