--- a/Doc/tools/extensions/pyspecific.py +++ b/Doc/tools/extensions/pyspecific.py @@ -103,7 +103,11 @@ class ImplementationDetail(Directive): # Support for documenting decorators from sphinx import addnodes -from sphinx.domains.python import PyModulelevel, PyClassmember +try: + from sphinx.domains.python import PyFunction, PyMethod +except ImportError: + from sphinx.domains.python import PyClassmember as PyMethod + from sphinx.domains.python import PyModulelevel as PyFunction class PyDecoratorMixin(object): def handle_signature(self, sig, signode): @@ -114,16 +118,16 @@ class PyDecoratorMixin(object): def needs_arglist(self): return False -class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel): +class PyDecoratorFunction(PyDecoratorMixin, PyFunction): def run(self): # a decorator function is a function after all self.name = 'py:function' - return PyModulelevel.run(self) + return PyFunction.run(self) -class PyDecoratorMethod(PyDecoratorMixin, PyClassmember): +class PyDecoratorMethod(PyDecoratorMixin, PyMethod): def run(self): self.name = 'py:method' - return PyClassmember.run(self) + return PyMethod.run(self) # Support for building "topic help" for pydoc --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-09-12-17-37-13.bpo-35293._cOwPD.rst @@ -0,0 +1 @@ +Fix RemovedInSphinx40Warning when building the documentation. Patch by Dong-hee Na.