diff options
author | Eli Bendersky <eliben@gmail.com> | 2013-08-04 00:48:41 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2013-08-04 00:48:41 (GMT) |
commit | b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d (patch) | |
tree | a920ff74d5db314fc8e28707071e76c40b77b97e /Lib/xml | |
parent | 739e75000f02dcf012d11c58e5995129293228a2 (diff) | |
parent | 2acc525a972b2b6b071eb5b9596ed1390d6d98e0 (diff) | |
download | cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.zip cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.tar.gz cpython-b9b6ce6f2c687092dfc99c912e52cdc32ae44c3d.tar.bz2 |
Merge fix for Issue #17011 from 3.3
Diffstat (limited to 'Lib/xml')
-rw-r--r-- | Lib/xml/etree/ElementPath.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/xml/etree/ElementPath.py b/Lib/xml/etree/ElementPath.py index bf984b9..d914ddb 100644 --- a/Lib/xml/etree/ElementPath.py +++ b/Lib/xml/etree/ElementPath.py @@ -249,10 +249,12 @@ class _SelectorContext: def iterfind(elem, path, namespaces=None): # compile selector pattern + cache_key = (path, None if namespaces is None + else tuple(sorted(namespaces.items()))) if path[-1:] == "/": path = path + "*" # implicit all (FIXME: keep this?) try: - selector = _cache[path] + selector = _cache[cache_key] except KeyError: if len(_cache) > 100: _cache.clear() @@ -272,7 +274,7 @@ def iterfind(elem, path, namespaces=None): token = next() except StopIteration: break - _cache[path] = selector + _cache[cache_key] = selector # execute selector pattern result = [elem] context = _SelectorContext(elem) |