summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-07-26 00:57:21 +0900
committerGitHub <noreply@github.com>2021-07-26 00:57:21 +0900
commitdf562b4343aaa29163aefafe04906cb5bf7ffe83 (patch)
treee4b25c89e77aebe521ce4d57de24e8e9edc9fe02
parentef53dec9c59a2379b69416fdd45c163606237c94 (diff)
parent5d8f925e02e6ab339deb8a603a7355d46571c3e4 (diff)
downloadsphinx-git-df562b4343aaa29163aefafe04906cb5bf7ffe83.tar.gz
Merge branch '4.1.x' into 9456_revert_9129
-rw-r--r--CHANGES1
-rw-r--r--sphinx/ext/autodoc/__init__.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGES b/CHANGES
index 05f7689f1..7c47b4bc1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -23,6 +23,7 @@ Bugs fixed
with the HEAD of 3.10
* #9490: autodoc: Some objects under ``typing`` module are not displayed well
with the HEAD of 3.10
+* #9436, #9471: autodoc: crashed if ``autodoc_class_signature = "separated"``
* #9456: html search: html_copy_source can't control the search summaries
* #9435: linkcheck: Failed to check anchors in github.com
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index 1cecb1f79..70d6ddc16 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -257,6 +257,9 @@ def between(marker: str, what: Sequence[str] = None, keepempty: bool = False,
# But we define this class here to keep compatibility (see #4538)
class Options(dict):
"""A dict/attribute hybrid that returns None on nonexisting keys."""
+ def copy(self) -> "Options":
+ return Options(super().copy())
+
def __getattr__(self, name: str) -> Any:
try:
return self[name.replace('_', '-')]
@@ -1445,9 +1448,11 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
super().__init__(*args)
if self.config.autodoc_class_signature == 'separated':
+ self.options = self.options.copy()
+
# show __init__() method
if self.options.special_members is None:
- self.options['special-members'] = {'__new__', '__init__'}
+ self.options['special-members'] = ['__new__', '__init__']
else:
self.options.special_members.append('__new__')
self.options.special_members.append('__init__')