Issue34941
Created on 2018-10-09 09:32 by jackjansen, last changed 2018-10-14 08:41 by serhiy.storchaka. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| testetns.py | jackjansen, 2018-10-09 09:32 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 9766 | merged | serhiy.storchaka, 2018-10-09 11:46 | |
| PR 9867 | merged | miss-islington, 2018-10-14 07:32 | |
| PR 9868 | merged | serhiy.storchaka, 2018-10-14 07:55 | |
| Messages (5) | |||
|---|---|---|---|
| msg327385 - (view) | Author: Jack Jansen (jackjansen) * | Date: 2018-10-09 09:32 | |
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.
|
|||
| msg327388 - (view) | Author: Jack Jansen (jackjansen) * | Date: 2018-10-09 09:58 | |
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. |
|||
| msg327695 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-10-14 07:32 | |
New changeset b11c5667f99c4f0018e3394c4d07c519d835671a by Serhiy Storchaka in branch 'master': bpo-34941: Fix searching Element subclasses. (GH-9766) https://github.com/python/cpython/commit/b11c5667f99c4f0018e3394c4d07c519d835671a |
|||
| msg327696 - (view) | Author: miss-islington (miss-islington) | Date: 2018-10-14 07:55 | |
New changeset b1c800303e8458e00428ae66351ad492a503a46f by Miss Islington (bot) in branch '3.7': bpo-34941: Fix searching Element subclasses. (GH-9766) https://github.com/python/cpython/commit/b1c800303e8458e00428ae66351ad492a503a46f |
|||
| msg327698 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-10-14 08:40 | |
New changeset 7c1c42b3209f1d2546daab6cd77f953eb255df6c by Serhiy Storchaka in branch '3.6': [3.6] bpo-34941: Fix searching Element subclasses. (GH-9766) (GH-9868) https://github.com/python/cpython/commit/7c1c42b3209f1d2546daab6cd77f953eb255df6c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-10-14 08:41:19 | serhiy.storchaka | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: - Python 2.7 |
| 2018-10-14 08:40:24 | serhiy.storchaka | set | messages: + msg327698 |
| 2018-10-14 07:55:52 | miss-islington | set | nosy:
+ miss-islington messages: + msg327696 |
| 2018-10-14 07:55:28 | serhiy.storchaka | set | pull_requests: + pull_request9236 |
| 2018-10-14 07:32:34 | miss-islington | set | pull_requests: + pull_request9235 |
| 2018-10-14 07:32:23 | serhiy.storchaka | set | messages: + msg327695 |
| 2018-10-09 11:46:26 | serhiy.storchaka | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request9153 |
| 2018-10-09 10:33:16 | serhiy.storchaka | set | assignee: serhiy.storchaka nosy:
+ serhiy.storchaka, eli.bendersky, scoder |
| 2018-10-09 09:58:34 | jackjansen | set | messages: + msg327388 |
| 2018-10-09 09:32:15 | jackjansen | create | |