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.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index 5f02bd979..51697432e 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -17,6 +17,8 @@ import warnings
from sphinx.deprecation import RemovedInSphinx40Warning, deprecated_alias
from sphinx.locale import __
from sphinx.util import logging
+from sphinx.util.console import terminal_safe
+
if False:
# For type annotation
@@ -36,12 +38,6 @@ NoneType = type(None)
sys_encoding = sys.getdefaultencoding()
-# terminal_safe(): safely encode a string for printing to the terminal
-def terminal_safe(s):
- # type: (str) -> str
- return s.encode('ascii', 'backslashreplace').decode('ascii')
-
-
# convert_with_2to3():
# support for running 2to3 over config files
def convert_with_2to3(filepath):
@@ -102,6 +98,7 @@ deprecated_alias('sphinx.util.pycompat',
'TextIOWrapper': io.TextIOWrapper,
'htmlescape': html.escape,
'indent': textwrap.indent,
+ 'terminal_safe': terminal_safe,
'u': '',
},
RemovedInSphinx40Warning)