diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-11-26 11:31:44 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-11-26 11:31:44 +0100 |
commit | 4cb57362deb23bca0f70f41ab1efa13390fcdbb1 (patch) | |
tree | d788d67c6ba915bde5f28a17f2b6cce5e85134d6 | |
parent | c30106ff2648cdafe7857654e9606c491b1acf4d (diff) | |
download | python-lxml-4cb57362deb23bca0f70f41ab1efa13390fcdbb1.tar.gz |
Work around Py2's lack of "re.ASCII".lxml-4.6.2
-rw-r--r-- | src/lxml/html/clean.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lxml/html/clean.py b/src/lxml/html/clean.py index 0fa1544c..0494357e 100644 --- a/src/lxml/html/clean.py +++ b/src/lxml/html/clean.py @@ -8,8 +8,9 @@ details. from __future__ import absolute_import -import re import copy +import re +import sys try: from urlparse import urlsplit from urllib import unquote_plus @@ -69,7 +70,8 @@ _replace_css_import = re.compile( r'@\s*import', re.I).sub _looks_like_tag_content = re.compile( - r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=', re.ASCII).search + r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=', + *((re.ASCII,) if sys.version_info[0] >= 3 else ())).search # All kinds of schemes besides just javascript: that can cause # execution: |