From 4a944d4ff26198abfe0001d0f0b51183ac33e215 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 30 Apr 2020 01:20:29 +0900 Subject: [PATCH] autodoc: The change of autodoc-process-docstring is cached (refs: #7469) --- CHANGES | 2 ++ sphinx/ext/autodoc/__init__.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index eb50e5484..940d8cecd 100644 --- a/CHANGES +++ b/CHANGES @@ -72,6 +72,8 @@ Bugs fixed * #6703: autodoc: incremental build does not work for imported objects * #7564: autodoc: annotations not to be shown for descriptors * #6588: autodoc: Decorated inherited method has no documentation +* #7469: autodoc: The change of autodoc-process-docstring for variables is + cached unexpectedly * #7535: sphinx-autogen: crashes when custom template uses inheritance * #7536: sphinx-autogen: crashes when template uses i18n feature * #2785: html: Bad alignment of equation links diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 99e34e036..eae199b33 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -468,7 +468,10 @@ class Documenter: key = ('.'.join(self.objpath[:-1]), self.objpath[-1]) if key in attr_docs: no_docstring = True - docstrings = [attr_docs[key]] + # make a copy of docstring for attributes to avoid cache + # the change of autodoc-process-docstring event. + docstrings = [list(attr_docs[key])] + for i, line in enumerate(self.process_doc(docstrings)): self.add_line(line, sourcename, i)