You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a TreeBuilder with a custom factory (returning a subclass of Element with some extra functionality) there is an issue with findall().
XPaths using an indexed predicate no longer work: the findall() result is always empty. The attached test script shows the problem.
I have analysed this as far as finding that the issue is in ElementPath.prepare_predicate.<locals>.select(), the last one. Specifically, the statement
elems = list(parent.findall(elem.tag))
always returns an empty list (if the Element class is subclassed).
When using Python 2.7 everything works fine. When adding a findall() method to the Element subclass that simply calls Element.findall() everything also works fine. I suspect some issue with the _elementtree C implementation but I don't understand it.
Correction to the last line:
When using Python 2.7 everything works fine. When adding a findall() method to the Element subclass that simply calls ElementPath.findall() everything also works fine. I suspect some issue with the _elementtree C implementation but I don't understand it.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: