[1.4.x] Fixed #18239 -- Subclassed HTMLParser only for selected Python versions
Only Python versions affected by http://bugs.python.org/issue670664 should patch HTMLParser.
This commit is contained in:
parent
3264894ee0
commit
57d9ccc4aa
@ -1,8 +1,19 @@
|
||||
import HTMLParser as _HTMLParser
|
||||
import re
|
||||
import sys
|
||||
|
||||
current_version = sys.version_info
|
||||
|
||||
class HTMLParser(_HTMLParser.HTMLParser):
|
||||
use_workaround = (
|
||||
(current_version < (2, 6, 8)) or
|
||||
(current_version >= (2, 7) and current_version < (2, 7, 3)) or
|
||||
(current_version >= (3, 0) and current_version < (3, 2, 3))
|
||||
)
|
||||
|
||||
if not use_workaround:
|
||||
HTMLParser = _HTMLParser.HTMLParser
|
||||
else:
|
||||
class HTMLParser(_HTMLParser.HTMLParser):
|
||||
"""
|
||||
Patched version of stdlib's HTMLParser with patch from:
|
||||
http://bugs.python.org/issue670664
|
||||
|
Loading…
x
Reference in New Issue
Block a user