mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Deprecate sphinx.util.pycompat:sys_encoding
This commit is contained in:
parent
b25deb259e
commit
2efc1065c0
1
CHANGES
1
CHANGES
@ -125,6 +125,7 @@ Deprecated
|
||||
* ``sphinx.util.pycompat.UnicodeMixin``
|
||||
* ``sphinx.util.pycompat.htmlescape``
|
||||
* ``sphinx.util.pycompat.indent``
|
||||
* ``sphinx.util.pycompat.sys_encoding``
|
||||
* ``sphinx.util.pycompat.terminal_safe()``
|
||||
* ``sphinx.util.pycompat.u``
|
||||
* ``sphinx.writers.latex.ExtBabel``
|
||||
|
@ -445,6 +445,11 @@ The following is a list of deprecated interfaces.
|
||||
- 4.0
|
||||
- ``textwrap.indent()``
|
||||
|
||||
* - ``sphinx.util.pycompat.sys_encoding``
|
||||
- 2.0
|
||||
- 4.0
|
||||
- ``sys.getdefaultencoding()``
|
||||
|
||||
* - ``sphinx.util.pycompat.terminal_safe()``
|
||||
- 2.0
|
||||
- 4.0
|
||||
|
@ -12,6 +12,7 @@ import posixpath
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from hashlib import sha1
|
||||
from os import path
|
||||
@ -26,7 +27,6 @@ from sphinx.util import logging
|
||||
from sphinx.util.math import get_node_equation_number, wrap_displaymath
|
||||
from sphinx.util.osutil import ensuredir
|
||||
from sphinx.util.png import read_png_depth, write_png_depth
|
||||
from sphinx.util.pycompat import sys_encoding
|
||||
|
||||
if False:
|
||||
# For type annotation
|
||||
@ -46,9 +46,9 @@ class MathExtError(SphinxError):
|
||||
def __init__(self, msg, stderr=None, stdout=None):
|
||||
# type: (str, bytes, bytes) -> None
|
||||
if stderr:
|
||||
msg += '\n[stderr]\n' + stderr.decode(sys_encoding, 'replace')
|
||||
msg += '\n[stderr]\n' + stderr.decode(sys.getdefaultencoding(), 'replace')
|
||||
if stdout:
|
||||
msg += '\n[stdout]\n' + stdout.decode(sys_encoding, 'replace')
|
||||
msg += '\n[stdout]\n' + stdout.decode(sys.getdefaultencoding(), 'replace')
|
||||
super().__init__(msg)
|
||||
|
||||
|
||||
|
@ -31,11 +31,6 @@ logger = logging.getLogger(__name__)
|
||||
# ------------------------------------------------------------------------------
|
||||
# Python 2/3 compatibility
|
||||
|
||||
# sys_encoding: some kind of default system encoding; should be used with
|
||||
# a lenient error handler
|
||||
sys_encoding = sys.getdefaultencoding()
|
||||
|
||||
|
||||
# convert_with_2to3():
|
||||
# support for running 2to3 over config files
|
||||
def convert_with_2to3(filepath):
|
||||
@ -98,6 +93,7 @@ deprecated_alias('sphinx.util.pycompat',
|
||||
'htmlescape': html.escape,
|
||||
'indent': textwrap.indent,
|
||||
'terminal_safe': terminal_safe,
|
||||
'sys_encoding': sys.getdefaultencoding(),
|
||||
'u': '',
|
||||
},
|
||||
RemovedInSphinx40Warning)
|
||||
|
Loading…
Reference in New Issue
Block a user