Comment 9 for bug 254278

Revision history for this message
Toshio Kuratomi (toshio) wrote :

The workaround posted in comment #5 looks like it will break if elementtree.ElementTree._escape_attrib() is ever called as cElementTree dosen't provide the private methods that are needed there.

I did notice that the following line was changed sometime between bzr-1.13 and bzr-2.1b1::

    except ImportError:
        from cElementTree import (ElementTree, SubElement, Element,
                                  XMLTreeBuilder, fromstring, tostring)
- import elementtree
+ import elementtree.ElementTree

The new import makes the code work on python2.4 when cElementTree is installed for me. (For Fedora EPEL packages which are stuck on bzr-1.13 because the API has changed. I'll backport this change to our package.)

I'm not sure which versions of python + bzr are still affected, the combination seems important. For instance, it seems like the following code might be broken if the particular version of cElementTree isn't importing xml.etree.ElementTree internally:

        from xml.etree.cElementTree import (ElementTree, SubElement, Element,
            XMLTreeBuilder, fromstring, tostring)
        import xml.etree as elementtree