Skip to content

Commit 6595cb0

Browse files
corona10vstinner
andauthored
bpo-35293: Remove RemovedInSphinx40Warning (GH-22198)
* bpo-35293: Remove RemovedInSphinx40Warning * Update Misc/NEWS.d/next/Documentation/2020-09-12-17-37-13.bpo-35293._cOwPD.rst Co-authored-by: Victor Stinner <[email protected]> * bpo-35293: Apply Victor's review Co-authored-by: Victor Stinner <[email protected]>
1 parent 8af239e commit 6595cb0

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

Doc/tools/extensions/pyspecific.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131
from sphinx.util.nodes import split_explicit_title
3232
from sphinx.writers.text import TextWriter, TextTranslator
3333
from sphinx.writers.latex import LaTeXTranslator
34-
from sphinx.domains.python import PyModulelevel, PyClassmember
34+
35+
try:
36+
from sphinx.domains.python import PyFunction, PyMethod
37+
except ImportError:
38+
from sphinx.domains.python import PyClassmember as PyMethod
39+
from sphinx.domains.python import PyModulelevel as PyFunction
3540

3641
# Support for checking for suspicious markup
3742

@@ -271,17 +276,18 @@ def needs_arglist(self):
271276
return False
272277

273278

274-
class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel):
279+
class PyDecoratorFunction(PyDecoratorMixin, PyFunction):
275280
def run(self):
276281
# a decorator function is a function after all
277282
self.name = 'py:function'
278-
return PyModulelevel.run(self)
283+
return PyFunction.run(self)
279284

280285

281-
class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
286+
# TODO: Use sphinx.domains.python.PyDecoratorMethod when possible
287+
class PyDecoratorMethod(PyDecoratorMixin, PyMethod):
282288
def run(self):
283289
self.name = 'py:method'
284-
return PyClassmember.run(self)
290+
return PyMethod.run(self)
285291

286292

287293
class PyCoroutineMixin(object):
@@ -298,31 +304,31 @@ def handle_signature(self, sig, signode):
298304
return ret
299305

300306

301-
class PyCoroutineFunction(PyCoroutineMixin, PyModulelevel):
307+
class PyCoroutineFunction(PyCoroutineMixin, PyFunction):
302308
def run(self):
303309
self.name = 'py:function'
304-
return PyModulelevel.run(self)
310+
return PyFunction.run(self)
305311

306312

307-
class PyCoroutineMethod(PyCoroutineMixin, PyClassmember):
313+
class PyCoroutineMethod(PyCoroutineMixin, PyMethod):
308314
def run(self):
309315
self.name = 'py:method'
310-
return PyClassmember.run(self)
316+
return PyMethod.run(self)
311317

312318

313-
class PyAwaitableFunction(PyAwaitableMixin, PyClassmember):
319+
class PyAwaitableFunction(PyAwaitableMixin, PyFunction):
314320
def run(self):
315321
self.name = 'py:function'
316-
return PyClassmember.run(self)
322+
return PyFunction.run(self)
317323

318324

319-
class PyAwaitableMethod(PyAwaitableMixin, PyClassmember):
325+
class PyAwaitableMethod(PyAwaitableMixin, PyMethod):
320326
def run(self):
321327
self.name = 'py:method'
322-
return PyClassmember.run(self)
328+
return PyMethod.run(self)
323329

324330

325-
class PyAbstractMethod(PyClassmember):
331+
class PyAbstractMethod(PyMethod):
326332

327333
def handle_signature(self, sig, signode):
328334
ret = super(PyAbstractMethod, self).handle_signature(sig, signode)
@@ -332,7 +338,7 @@ def handle_signature(self, sig, signode):
332338

333339
def run(self):
334340
self.name = 'py:method'
335-
return PyClassmember.run(self)
341+
return PyMethod.run(self)
336342

337343

338344
# Support for documenting version of removal in deprecations
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix RemovedInSphinx40Warning when building the documentation. Patch by Dong-hee Na.

0 commit comments

Comments
 (0)