Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-02-06 09:30:06 +0300
committerGitHub <noreply@github.com>2022-02-06 09:30:06 +0300
commit73f980641c28660aaa2412fced5b747128e65931 (patch)
tree539763acdb47b56d1bc1baa1d3e8132d2e621f48
parent9ab02f04e1c8d37cac6db730cb9a085f445a219c (diff)
parenteaefbef1eb67065797f19565a2033de0c0136e7b (diff)
Merge pull request #10149 from tk0miya/9876_catch_PycodeError
Fix #9876: autodoc: Failed to document a class on binary module
-rw-r--r--CHANGES3
-rw-r--r--sphinx/ext/autodoc/__init__.py9
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 3c2ec0537..446b75b05 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,9 @@ Features added
Bugs fixed
----------
+* #9876: autodoc: Failed to document an imported class that is built from native
+ binary module
+
Testing
--------
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
index 8a86f05b1..e3b96c522 100644
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1771,9 +1771,12 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
def add_content(self, more_content: Optional[StringList], no_docstring: bool = False
) -> None:
if self.doc_as_attr and self.modname != self.get_real_modname():
- # override analyzer to obtain doccomment around its definition.
- self.analyzer = ModuleAnalyzer.for_module(self.modname)
- self.analyzer.analyze()
+ try:
+ # override analyzer to obtain doccomment around its definition.
+ self.analyzer = ModuleAnalyzer.for_module(self.modname)
+ self.analyzer.analyze()
+ except PycodeError:
+ pass
if self.doc_as_attr and not self.get_variable_comment():
try: