This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: ElementPath ignores different namespace mappings for the same path expression
Type: behavior Stage: resolved
Components: Library (Lib), XML Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eli.bendersky, python-dev, scoder, silverbacknet
Priority: normal Keywords:

Created on 2013-01-22 07:16 by scoder, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg180366 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2013-01-22 07:16
There's a bug originally report for lxml that also applies to ElementTree:

Passing different namespace mappings into the Element.find*() methods will always reuse the first one due to incorrect caching based only on the literal path, not all parameters. My fix is here:

The lookup performance regression when a namespace mapping is passed (sorting etc.) is acceptable as most use cases won't pass any namespaces anyway, so this is a problem that rarely shows in practice.
msg180367 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2013-01-22 07:25
Here is a test case (for lxml):
msg194316 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-04 00:49
New changeset 854ded9135c2 by Eli Bendersky in branch '3.3':
Issue #17011: Fix caching of xpath path when namespaces are present.

New changeset ce0be0d03c0a by Eli Bendersky in branch 'default':
Merge fix for Issue #17011 from 3.3
msg194317 - (view) Author: Eli Bendersky (eli.bendersky) * (Python committer) Date: 2013-08-04 00:49
Fixed. Thanks!
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61213
2013-12-06 17:39:19eric.araujosetresolution: duplicate -> fixed
2013-12-06 17:39:08eric.araujosetresolution: fixed -> duplicate
2013-08-04 00:49:28eli.benderskysetstatus: open -> closed
resolution: fixed
messages: + msg194317

stage: resolved
2013-08-04 00:49:02python-devsetnosy: + python-dev
messages: + msg194316
2013-01-31 02:15:34silverbacknetsetnosy: + silverbacknet
2013-01-22 09:07:34serhiy.storchakasetnosy: + eli.bendersky
2013-01-22 07:25:12scodersetmessages: + msg180367
2013-01-22 07:16:47scodersetcomponents: + XML
2013-01-22 07:16:36scodersetcomponents: + Library (Lib), - XML
2013-01-22 07:16:24scodercreate