summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/html.py12
-rw-r--r--django/utils/html_parser.py5
2 files changed, 3 insertions, 14 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index a596662d22..758d458f40 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -3,7 +3,6 @@
from __future__ import unicode_literals
import re
-import sys
import warnings
from django.utils.deprecation import RemovedInDjango20Warning
@@ -135,12 +134,7 @@ linebreaks = allow_lazy(linebreaks, six.text_type)
class MLStripper(HTMLParser):
def __init__(self):
- # The strict parameter was added in Python 3.2 with a default of True.
- # The default changed to False in Python 3.3 and was deprecated.
- if sys.version_info[:2] == (3, 2):
- HTMLParser.__init__(self, strict=False)
- else:
- HTMLParser.__init__(self)
+ HTMLParser.__init__(self)
self.reset()
self.fed = []
@@ -168,9 +162,7 @@ def _strip_once(value):
return value
try:
s.close()
- except (HTMLParseError, UnboundLocalError):
- # UnboundLocalError because of http://bugs.python.org/issue17802
- # on Python 3.2, triggered by strict=False mode of HTMLParser
+ except HTMLParseError:
return s.get_data() + s.rawdata
else:
return s.get_data()
diff --git a/django/utils/html_parser.py b/django/utils/html_parser.py
index ab1f654978..4aff4a9a78 100644
--- a/django/utils/html_parser.py
+++ b/django/utils/html_parser.py
@@ -4,10 +4,7 @@ import sys
current_version = sys.version_info
-use_workaround = (
- (current_version < (2, 7, 3)) or
- (current_version >= (3, 0) and current_version < (3, 2, 3))
-)
+use_workaround = current_version < (2, 7, 3)
try:
HTMLParseError = _html_parser.HTMLParseError