[issue16082] xml.etree.ElementTree.tostringlist does conform to it's documentation

Einar Fløystad Dørum report at bugs.python.org
Fri Sep 28 12:51:27 CEST 2012


New submission from Einar Fløystad Dørum:

The tostringlist documentation says "Returns a list of (optionally) encoded strings containing the XML data. It does not guarantee any specific sequence, except that "".join(tostringlist(element)) == tostring(element).". 
But in reality it is possible to get tostringlist to return a string and not a list. 
The following code will demonstrates problem, by failing with a TypeError:

from xml.etree.ElementTree import Element, tostringlist, tostring

element = Element("foo")
print ("".join(tostringlist(element)) == tostring(element))

----------
components: XML
messages: 171434
nosy: einarfd
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.tostringlist does conform to it's documentation
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16082>
_______________________________________


More information about the Python-bugs-list mailing list