mirror of
https://github.com/django/django.git
synced 2025-06-08 13:09:13 +00:00
[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,7 +1,18 @@
|
|||||||
import HTMLParser as _HTMLParser
|
import HTMLParser as _HTMLParser
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
current_version = sys.version_info
|
||||||
|
|
||||||
|
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):
|
class HTMLParser(_HTMLParser.HTMLParser):
|
||||||
"""
|
"""
|
||||||
Patched version of stdlib's HTMLParser with patch from:
|
Patched version of stdlib's HTMLParser with patch from:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user