summaryrefslogtreecommitdiff
path: root/sphinx/util/pycompat.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/pycompat.py')
-rw-r--r--sphinx/util/pycompat.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index cd9f6e2fc..9e081b02f 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -64,6 +64,11 @@ else:
return s.encode('ascii', 'backslashreplace')
+try:
+ from html import escape as htmlescape
+except ImportError:
+ from cgi import escape as htmlescape
+
# ------------------------------------------------------------------------------
# Missing builtins and itertools in Python < 2.6