Deprecate SphinxBaseFileInput

This commit is contained in:
Takeshi KOMIYA 2018-12-17 22:06:51 +09:00
parent de49b991f6
commit 636ca67528
3 changed files with 9 additions and 7 deletions

View File

@ -63,6 +63,7 @@ Deprecated
* ``sphinx.ext.autosummary.Autosummary.warnings``
* ``sphinx.ext.autosummary.Autosummary.result``
* ``sphinx.ext.doctest.doctest_encode()``
* ``sphinx.io.SphinxBaseFileInput``
* ``sphinx.io.SphinxRSTFileInput``
* ``sphinx.registry.SphinxComponentRegistry.add_source_input()``
* ``sphinx.testing.util.remove_unicode_literal()``

View File

@ -268,6 +268,11 @@ The following is a list of deprecated interfaces.
- 3.0
- N/A
* - ``sphinx.io.SphinxBaseFileInput``
- 2.0
- 3.0
- N/A
* - ``sphinx.io.SphinxRSTFileInput``
- 2.0
- 3.0

View File

@ -185,15 +185,14 @@ class SphinxBaseFileInput(FileInput):
self.app = app
self.env = env
warnings.warn('%s is deprecated.' % self.__class__.__name__,
RemovedInSphinx30Warning, stacklevel=2)
kwds['error_handler'] = 'sphinx' # py3: handle error on open.
super().__init__(*args, **kwds)
def warn_and_replace(self, error):
# type: (Any) -> Tuple
warnings.warn('SphinxBaseFileInput.warn_and_replace() is deprecated. '
'Use UnicodeDecodeErrorHandler instead.',
RemovedInSphinx30Warning, stacklevel=2)
return UnicodeDecodeErrorHandler(self.env.docname)(error)
@ -246,9 +245,6 @@ class SphinxRSTFileInput(SphinxBaseFileInput):
def read(self): # type: ignore
# type: () -> StringList
warnings.warn('SphinxRSTFileInput is deprecated.',
RemovedInSphinx30Warning, stacklevel=2)
inputstring = super().read()
lines = string2lines(inputstring, convert_whitespace=True)
content = StringList()