[Yum-devel] [PATCH] Fix main speed issue in to_xml(), slows down new createrepo a lot. BZ 716235.

Zdenek Pavlas zpavlas at redhat.com
Thu Nov 15 10:11:06 UTC 2012


> +        return unicode(item, 'utf-8')

NAK, must still kill some valid unicode.

b: _ugly_utf8_string_hack('\x07') => ''
a: _ugly_utf8_string_hack('\x07') => u'\x07'

>>> from xml.etree import cElementTree as ET
>>> blah=ET.Element('blah')
>>> blah.text = u'\x07'
>>> ET.tostring(blah, encoding='utf8')
"<?xml version='1.0' encoding='utf8'?>\n<blah>\x07</blah>"
>>> ET.fromstring(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 106, in XML
cElementTree.ParseError: not well-formed (invalid token): line 2, column 6

But for unicode input, things haven't changed.
We mostly feed UTF8 to to_xml(), probably.


More information about the Yum-devel mailing list