[merge] python 2.5 fixes
John Arbash Meinel
john at arbash-meinel.com
Wed Sep 27 18:38:18 BST 2006
Martin Pool wrote:
> 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
> 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.
I completely agree. We definitely want to use cElementTree if it can be
>> 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
We just need to import our ElementTree before cElementTree, and install
it as 'sys.modules["elementtree"] = bzrlib.utils.elementtree'
cElementTree uses python ElementTree for writing. we've changed our
serialization code so we don't depend on raw ElementTree at all.
You have my +1 to changing the import code.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060927/f54d9372/attachment.pgp
More information about the bazaar