diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-08 11:21:20 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-08 11:21:20 +0900 |
| commit | 6ba6f0eeb6689503f55d1d50e1f79489c9a7bf42 (patch) | |
| tree | bb314e28f17d121d80f1a56b987eac27d1f30ba1 | |
| parent | 5ab6d9e321df9e5c11716b863c30c482e2235286 (diff) | |
| parent | cfb9f8387b85480d7ac71bf1eece027323659cdb (diff) | |
| download | sphinx-git-6ba6f0eeb6689503f55d1d50e1f79489c9a7bf42.tar.gz | |
Merge pull request #7274 from tk0miya/7266_update_deprecation_message
Fix #7266: Update deprecation messages for PyClassmember and PyModulelevel
| -rw-r--r-- | sphinx/domains/python.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index ac6ee4839..be6bf34e3 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -397,8 +397,14 @@ class PyModulelevel(PyObject): """ def run(self) -> List[Node]: - warnings.warn('PyModulelevel is deprecated.', - RemovedInSphinx40Warning) + for cls in self.__class__.__mro__: + if cls.__name__ != 'DirectiveAdapter': + warnings.warn('PyModulelevel is deprecated. ' + 'Please check the implementation of %s' % cls, + RemovedInSphinx40Warning) + break + else: + warnings.warn('PyModulelevel is deprecated', RemovedInSphinx40Warning) return super().run() @@ -500,8 +506,14 @@ class PyClassmember(PyObject): """ def run(self) -> List[Node]: - warnings.warn('PyClassmember is deprecated.', - RemovedInSphinx40Warning) + for cls in self.__class__.__mro__: + if cls.__name__ != 'DirectiveAdapter': + warnings.warn('PyClassmember is deprecated. ' + 'Please check the implementation of %s' % cls, + RemovedInSphinx40Warning) + break + else: + warnings.warn('PyClassmember is deprecated', RemovedInSphinx40Warning) return super().run() |
