[issue13988] Expose the C implementation of ElementTree by default when importing ElementTree

Florent Xicluna report at bugs.python.org
Fri Feb 10 17:30:11 CET 2012


Florent Xicluna <florent.xicluna at gmail.com> added the comment:

> If possible I would avoid pyElementTree,

Me too:
 - __name__ and __qualname__ would be less confusing
 - the cElementTree accelerator uses large parts of Python implementation

> ElementTree is different - it's pretty much two separate implementations of the same API.

Not fully separated... there's some python code hidden in the C module.

> From a performance point of view, consider the (by far) common case
> - where _elementtree *is* successfully imported.
> ... for each invocation, the whole import of the Python code has
> to be done, just to reach the overriding import * at the end.

This point is wrong... the _elementtree.c accelerator imports Python ElementTree already.

As you can see on lines 2938 to 2945, the change could lead to an import cycle:
http://hg.python.org/cpython/file/705b56512287/Modules/_elementtree.c#l2938

Trying to sort this out, it already gives me a headache.
I would like to remove the Python bootstrap code from the C module and try to do it differently, in a more standard way.

----------
stage:  -> needs patch
type:  -> performance

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13988>
_______________________________________


More information about the Python-bugs-list mailing list