diff options
author | R David Murray <rdmurray@bitdance.com> | 2016-09-08 13:59:53 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2016-09-08 13:59:53 -0400 |
commit | 44b548dda872c0d4f30afd6b44fd74b053a55ad8 (patch) | |
tree | b3c1ff8485bc279000f9db95491ebc69a4385876 /Lib/xml/etree/ElementPath.py | |
parent | 513d7478a136e7646075592da2593476299cc8be (diff) | |
download | cpython-git-44b548dda872c0d4f30afd6b44fd74b053a55ad8.tar.gz |
#27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.
Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
Diffstat (limited to 'Lib/xml/etree/ElementPath.py')
-rw-r--r-- | Lib/xml/etree/ElementPath.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/xml/etree/ElementPath.py b/Lib/xml/etree/ElementPath.py index 5de42324c2..ab6b79a777 100644 --- a/Lib/xml/etree/ElementPath.py +++ b/Lib/xml/etree/ElementPath.py @@ -59,15 +59,15 @@ import re xpath_tokenizer_re = re.compile( - "(" - "'[^']*'|\"[^\"]*\"|" - "::|" - "//?|" - "\.\.|" - "\(\)|" - "[/.*:\[\]\(\)@=])|" - "((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|" - "\s+" + r"(" + r"'[^']*'|\"[^\"]*\"|" + r"::|" + r"//?|" + r"\.\.|" + r"\(\)|" + r"[/.*:\[\]\(\)@=])|" + r"((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|" + r"\s+" ) def xpath_tokenizer(pattern, namespaces=None): @@ -180,7 +180,7 @@ def prepare_predicate(next, token): if elem.get(key) == value: yield elem return select - if signature == "-" and not re.match("\-?\d+$", predicate[0]): + if signature == "-" and not re.match(r"\-?\d+$", predicate[0]): # [tag] tag = predicate[0] def select(context, result): @@ -188,7 +188,7 @@ def prepare_predicate(next, token): if elem.find(tag) is not None: yield elem return select - if signature == "-='" and not re.match("\-?\d+$", predicate[0]): + if signature == "-='" and not re.match(r"\-?\d+$", predicate[0]): # [tag='value'] tag = predicate[0] value = predicate[-1] |