[merge] python 2.5 fixes

Martin Pool mbp at canonical.com
Wed Sep 27 01:31:54 BST 2006


On 25 Sep 2006, John Arbash Meinel <john at arbash-meinel.com> wrote:
> > It also cleans up some code that tries to access elementtree's
> > ElementTree class, as opposed othte one from cElementTree.  As far as I
> > can see they're the same thing - is there some reason why we can't just
> > import the name once?  Anyhow, with this change it passes tests on both
> > 2.4 and 2.5.
> 
> -1 to your changes.
> 
> Actually, they aren't the same thing. The elementtree class is at
> elementtree.ElementTree.ElementTree()

OK.  Very suboptimal naming there.  How about changing it to use the
xml.etree. classes, but removing the rest of the patch?  Since
cElementTree ships with python2.5 it seems perverse not to use it.

> Also, as part of my 'improve startup times' work, I would like for us to
> modify our copy of ElementTree to avoid compiling a nasty regex that
> costs us a lot of startup time, and then install the modified version as
> the 'official' version. (It would be api consistent with the original,
> just a couple modifications to make it load faster).
> 
> If you don't want to change the ElementTree sources (which I think we
> should, and contribute the changes upstream). I can modify
> 're.compile()' before importing elementtree, and then restore it afterwards.

I'm not sure what you mean by "installing the modified version as the
official version."  I'm in favour of sending changes upstream to them.

One problem with shipping a changed version of the ElementTree source is
that then we need to either

 - do without cElementTree
 - or require a C compiler to install
 - or use the system's cElementTree but our own ElementTree

-- 
Martin




More information about the bazaar mailing list