Avoid duplicate calls to autodoc-process-docstring (#4198)

This commit is contained in:
Joel Nothman 2018-01-08 13:09:29 +11:00 committed by Takayuki SHIMIZUKAWA
parent e015ce2a0f
commit db415ba05c
2 changed files with 5 additions and 1 deletions

View File

@ -325,7 +325,7 @@ class Autosummary(Directive):
# -- Grab the summary # -- Grab the summary
documenter.add_content(None) documenter.add_content(None)
doc = list(documenter.process_doc([self.result.data])) doc = self.result.data
while doc and not doc[0].strip(): while doc and not doc[0].strip():
doc.pop(0) doc.pop(0)

View File

@ -73,6 +73,10 @@ def test_get_items_summary(app, status, warning):
def handler(app, what, name, obj, options, lines): def handler(app, what, name, obj, options, lines):
assert isinstance(lines, list) assert isinstance(lines, list)
# ensure no docstring is processed twice:
assert 'THIS HAS BEEN HANDLED' not in lines
lines.append('THIS HAS BEEN HANDLED')
app.connect('autodoc-process-docstring', handler) app.connect('autodoc-process-docstring', handler)
sphinx.ext.autosummary.Autosummary.get_items = new_get_items sphinx.ext.autosummary.Autosummary.get_items = new_get_items