Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicate calls to autodoc-process-docstring #4198

Merged
merged 3 commits into from
Jan 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sphinx/ext/autosummary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def get_items(self, names):
# -- Grab the summary

documenter.add_content(None)
doc = list(documenter.process_doc([self.result.data]))
doc = self.result.data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this fix is correct. Double calling process_doc is caused by leaving a call of process_doc which became unnecessary on #1444.


while doc and not doc[0].strip():
doc.pop(0)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_ext_autosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def new_get_items(self, names, *args, **kwargs):

def handler(app, what, name, obj, options, lines):
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)

sphinx.ext.autosummary.Autosummary.get_items = new_get_items
Expand Down