diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-05-03 22:40:19 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-05-03 23:34:35 +0900 |
commit | 41b4a77dea51cf5eb16f9a3fdc27426827313d54 (patch) | |
tree | aad1d45e1e780ef69a4872d1d4122d5292fc0755 /sphinx/domains/python.py | |
parent | a5cba8cdbb9f44721885c8555bf875df1f59e199 (diff) | |
download | sphinx-git-41b4a77dea51cf5eb16f9a3fdc27426827313d54.tar.gz |
Add stacklevel parameter to warnings.warn() call
Diffstat (limited to 'sphinx/domains/python.py')
-rw-r--r-- | sphinx/domains/python.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 99339ccbd..39c7de142 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -530,10 +530,11 @@ class PyModulelevel(PyObject): if cls.__name__ != 'DirectiveAdapter': warnings.warn('PyModulelevel is deprecated. ' 'Please check the implementation of %s' % cls, - RemovedInSphinx40Warning) + RemovedInSphinx40Warning, stacklevel=2) break else: - warnings.warn('PyModulelevel is deprecated', RemovedInSphinx40Warning) + warnings.warn('PyModulelevel is deprecated', + RemovedInSphinx40Warning, stacklevel=2) return super().run() @@ -675,10 +676,11 @@ class PyClassmember(PyObject): if cls.__name__ != 'DirectiveAdapter': warnings.warn('PyClassmember is deprecated. ' 'Please check the implementation of %s' % cls, - RemovedInSphinx40Warning) + RemovedInSphinx40Warning, stacklevel=2) break else: - warnings.warn('PyClassmember is deprecated', RemovedInSphinx40Warning) + warnings.warn('PyClassmember is deprecated', + RemovedInSphinx40Warning, stacklevel=2) return super().run() @@ -896,10 +898,11 @@ class PyDecoratorMixin: if cls.__name__ != 'DirectiveAdapter': warnings.warn('PyDecoratorMixin is deprecated. ' 'Please check the implementation of %s' % cls, - RemovedInSphinx50Warning) + RemovedInSphinx50Warning, stacklevel=2) break else: - warnings.warn('PyDecoratorMixin is deprecated', RemovedInSphinx50Warning) + warnings.warn('PyDecoratorMixin is deprecated', + RemovedInSphinx50Warning, stacklevel=2) ret = super().handle_signature(sig, signode) # type: ignore signode.insert(0, addnodes.desc_addname('@', '@')) |