Merge pull request #6965 from tk0miya/deprecate_get_module_source

Deprecate sphinx.util:get_module_source()
This commit is contained in:
Takeshi KOMIYA 2019-12-27 22:05:00 +09:00 committed by GitHub
commit 402d0114b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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: