Message179532
I found such example. It happens when the data contains XML entity.
>>> ET.tostring(ET.XML('<root>a&</root>'), method='text', encoding='unicode')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/xml/etree/ElementTree.py", line 1171, in tostring
ElementTree(element).write(stream, encoding, method=method)
File "/home/serhiy/py/cpython/Lib/xml/etree/ElementTree.py", line 824, in write
_serialize_text(write, self._root)
File "/home/serhiy/py/cpython/Lib/xml/etree/ElementTree.py", line 1057, in _serialize_text
write(part)
TypeError: string argument expected, got 'list'
Indeed, itertext() returns a list of lists instead of list of strings.
>>> list(ET.XML('<root>a&</root>').itertext())
[['a', '&']]
The bug is in the C implementation of itertext(). |
|
Date |
User |
Action |
Args |
2013-01-10 08:21:07 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ezio.melotti, eli.bendersky, Frank |
2013-01-10 08:21:07 | serhiy.storchaka | set | messageid: <1357806067.79.0.352083513309.issue16913@psf.upfronthosting.co.za> |
2013-01-10 08:21:07 | serhiy.storchaka | link | issue16913 messages |
2013-01-10 08:21:07 | serhiy.storchaka | create | |
|