Skip to content

Commit

Permalink
Merge pull request #6965 from tk0miya/deprecate_get_module_source
Browse files Browse the repository at this point in the history
Deprecate sphinx.util:get_module_source()
  • Loading branch information
tk0miya committed Dec 27, 2019
2 parents 4dd9056 + 7581ee1 commit 402d011
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Deprecated
* ``sphinx.environment.collectors.indexentries.IndexEntriesCollector``
* ``sphinx.io.FiletypeNotFoundError``
* ``sphinx.io.get_filetype()``
* ``sphinx.util.get_module_source()``

Features added
--------------
Expand Down
5 changes: 5 additions & 0 deletions doc/extdev/deprecated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions sphinx/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 402d011

Please sign in to comment.