Deprecate sphinx.util:get_module_source()

This commit is contained in:
Takeshi KOMIYA
2019-12-27 01:57:39 +09:00
parent 4dd905605e
commit 7581ee1084
3 changed files with 8 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ Deprecated
* ``sphinx.environment.collectors.indexentries.IndexEntriesCollector``
* ``sphinx.io.FiletypeNotFoundError``
* ``sphinx.io.get_filetype()``
* ``sphinx.util.get_module_source()``
Features added
--------------

View File

@@ -46,6 +46,11 @@ The following is a list of deprecated interfaces.
- 4.0
- ``sphinx.util.get_filetype()``
* - ``sphinx.util.get_module_source()``
- 2.4
- 4.0
- N/A
* - ``sphinx.builders.gettext.POHEADER``
- 2.3
- 4.0

View File

@@ -282,6 +282,8 @@ def get_module_source(modname: str) -> Tuple[str, str]:
Can return ('file', 'filename') in which case the source is in the given
file, or ('string', 'source') which which case the source is the string.
"""
warnings.warn('get_module_source() is deprecated.',
RemovedInSphinx40Warning, stacklevel=2)
try:
mod = import_module(modname)
except Exception as err: