[Python-Dev] Update xml.etree.ElementTree for Python 2.7 and 3.2

Florent Xicluna florent.xicluna at gmail.com
Thu Feb 18 10:21:36 CET 2010


Hello,

On November 2006 and September 2007 Fredrik proposed to update "xml.etree" in
Python 2.6 with the upcoming version 1.3.
Now we are three years later, and the version shipped with 2.7alpha3 is 1.2.6.
http://bugs.python.org/issue1602189#msg54944
http://bugs.python.org/issue1143

This would not be an issue, without the numerous bug reports accumulating on
bugs.python.org. Most of these reports are waiting for the 1.3 release.
Three months ago I worked on some of these issues, and after fixing them
separately, I proposed a patch which merges the latest 1.3 snapshot (released in
2007) within the standard library. The aim is to provide a bug-free version of
ElementTree/cElementTree in the standard library.
For this purpose, I grew the test suite from 300 lines to 1800 lines, using both
the tests from upstream and the tests proposed by Neil Muller on issue #6232. To
ensure consistency, now the test_suite for the C implementation is the same as
the Python implementation.
http://bugs.python.org/issue6472

We are still interested with the upcoming release of ElementTree, but we should
adopt a pragmatic approach: the xml.etree.ElementTree needs to be fixed for all
Python users, even if 1.3 is not ready before 2.7beta. This is the only purpose
of the patch.

The patch sticks as much as possible to the upstream library. Initially I kept
all the new features of the 1.3 branch in the patch.
It should ease the integration of 1.3 final when it is released.
With the last comment from Fredrik, I think to be more conservative: I plan to
split out the experimental C API from the package. It is not required for the
bug-fix release, and there's some risk of incompatibility with the final design
of the API, which is still secret.

As a side-effect, the patch will add some features and methods from the 1.3
branch (some of them where requested in the bug tracker):
 - ET.fromstringlist(), ET.tostringlist()
 - Element.extend(), Element.iter(), Element.itertext()
 - new selector engine
 - extended slicing

However the highlighted features of this patch are:
 - to fix many bugs which were postponed because of 1.3 release
 - to ensure consistency between C and Python implementations (with tests)
 - to provide a better test coverage

The patch is uploaded on Rietveld for review.
The 3.x version of the patch will be updated after 2.x is merged in trunk.
The patch covers documentation, too.
http://codereview.appspot.com/207048/show

It's time to comment and review.
The proposed plan is to merge the patch in trunk before 2.7 alpha4.

Best regards,

-- 
Florent Xicluna



More information about the Python-Dev mailing list