From 53f0d4e64622f796d67eec148b9c8d1bff8ff8a1 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 25 Mar 2020 00:43:56 +0900 Subject: [PATCH] Deprecate: The module argument of find_autosummary_in_docstring() --- CHANGES | 3 +++ doc/extdev/deprecated.rst | 6 ++++++ sphinx/ext/autosummary/generate.py | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 863a5ea24..ab10e7ca8 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ Incompatible changes Deprecated ---------- +* The ``module`` argument of ``sphinx.ext.autosummary.generate. + find_autosummary_in_docstring()`` + Features added -------------- diff --git a/doc/extdev/deprecated.rst b/doc/extdev/deprecated.rst index 9551f8613..b0468a39f 100644 --- a/doc/extdev/deprecated.rst +++ b/doc/extdev/deprecated.rst @@ -26,6 +26,12 @@ The following is a list of deprecated interfaces. - (will be) Removed - Alternatives + * - The ``module`` argument of + ``sphinx.ext.autosummary.generate.find_autosummary_in_docstring()`` + - 3.0 + - 5.0 + - N/A + * - ``desc_signature['first']`` - - 3.0 diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 61c3bae3e..7b128bea5 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -33,7 +33,7 @@ import sphinx.locale from sphinx import __display_version__ from sphinx import package_dir from sphinx.builders import Builder -from sphinx.deprecation import RemovedInSphinx40Warning +from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning from sphinx.ext.autodoc import Documenter from sphinx.ext.autosummary import import_by_name, get_documenter from sphinx.jinja2glue import BuiltinTemplateLoader @@ -332,6 +332,10 @@ def find_autosummary_in_docstring(name: str, module: str = None, filename: str = See `find_autosummary_in_lines`. """ + if module: + warnings.warn('module argument for find_autosummary_in_docstring() is deprecated.', + RemovedInSphinx50Warning) + try: real_name, obj, parent, modname = import_by_name(name) lines = pydoc.getdoc(obj).splitlines()