summaryrefslogtreecommitdiff
path: root/django/utils/html.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/utils/html.py')
-rw-r--r--django/utils/html.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/utils/html.py b/django/utils/html.py
index 66cbcee8f3..4197dc9e23 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -183,8 +183,10 @@ def strip_tags(value):
# is redundant, but helps to reduce number of executions of _strip_once.
while '<' in value and '>' in value:
new_value = _strip_once(value)
- if new_value == value:
- # _strip_once was not able to detect more tags
+ if len(new_value) >= len(value):
+ # _strip_once was not able to detect more tags or length increased
+ # due to http://bugs.python.org/issue20288
+ # (affects Python 2 < 2.7.7 and Python 3 < 3.3.5)
break
value = new_value
return value