Skip to content

Commit 4cb5736

Browse files
committed
Work around Py2's lack of "re.ASCII".
1 parent c30106f commit 4cb5736

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/lxml/html/clean.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
from __future__ import absolute_import
1010

11-
import re
1211
import copy
12+
import re
13+
import sys
1314
try:
1415
from urlparse import urlsplit
1516
from urllib import unquote_plus
@@ -69,7 +70,8 @@
6970
r'@\s*import', re.I).sub
7071

7172
_looks_like_tag_content = re.compile(
72-
r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=', re.ASCII).search
73+
r'</?[a-zA-Z]+|\son[a-zA-Z]+\s*=',
74+
*((re.ASCII,) if sys.version_info[0] >= 3 else ())).search
7375

7476
# All kinds of schemes besides just javascript: that can cause
7577
# execution:

0 commit comments

Comments
 (0)