From b0b3f5a677162f97f7e0fb62428fa09468b0f23c Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 7 Apr 2019 21:58:15 +0900 Subject: [PATCH] deprecate PyClassmember class --- CHANGES | 1 + doc/extdev/deprecated.rst | 8 ++++++++ sphinx/domains/python.py | 12 +++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8d129f2e0..87510437e 100644 --- a/CHANGES +++ b/CHANGES @@ -33,6 +33,7 @@ Deprecated * ``sphinx.directives.TabularColumns`` * ``sphinx.directives.TocTree`` * ``sphinx.directives.VersionChange`` +* ``sphinx.domains.python.PyClassmember`` * ``sphinx.domains.std.StandardDomain._resolve_citation_xref()`` * ``sphinx.domains.std.StandardDomain.note_citations()`` * ``sphinx.domains.std.StandardDomain.note_citation_refs()`` diff --git a/doc/extdev/deprecated.rst b/doc/extdev/deprecated.rst index beeafab08..ffe0bdccb 100644 --- a/doc/extdev/deprecated.rst +++ b/doc/extdev/deprecated.rst @@ -116,6 +116,14 @@ The following is a list of deprecated interfaces. - 4.0 - ``sphinx.directives.other.VersionChange`` + * - ``sphinx.domains.python.PyClassmember`` + - 2.1 + - 4.0 + - ``sphinx.domains.python.PyAttribute``, + ``sphinx.domains.python.PyMethod``, + ``sphinx.domains.python.PyClassMethod`` and + ``sphinx.domains.python.PyStaticMethod`` + * - ``sphinx.domains.std.StandardDomain._resolve_citation_xref()`` - 2.1 - 4.0 diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index c7e9e1b68..de31eef00 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -9,13 +9,16 @@ """ import re +import warnings from typing import cast from docutils import nodes from docutils.parsers.rst import directives from sphinx import addnodes, locale -from sphinx.deprecation import DeprecatedDict, RemovedInSphinx30Warning +from sphinx.deprecation import ( + DeprecatedDict, RemovedInSphinx30Warning, RemovedInSphinx40Warning +) from sphinx.directives import ObjectDescription from sphinx.domains import Domain, ObjType, Index, IndexEntry from sphinx.locale import _, __ @@ -453,6 +456,13 @@ class PyClassmember(PyObject): Description of a class member (methods, attributes). """ + def run(self): + # type: () -> List[nodes.Node] + warnings.warn('PyClassmember is deprecated.', + RemovedInSphinx40Warning) + + return super().run() + def needs_arglist(self): # type: () -> bool return self.objtype.endswith('method')