Closes #2243: ignore strange docstring types in class docs, like already done for method docs.

This commit is contained in:
Georg Brandl 2016-01-17 09:08:29 +01:00
parent 46d7e8558e
commit 8167a9b7ad
2 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@ Bugs fixed
* Fix line numbers was not shown on warnings in LaTeX and texinfo builders
* Fix line numbers was not shown on warnings of indecies
* #2026: Fix LaTeX builder rais error if parsed-literal includes links
* #2243: Ignore strange docstring types for classes, do not crash
Release 1.3.4 (released Jan 12, 2016)
=====================================

View File

@ -1170,9 +1170,11 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter):
docstrings.append(initdocstring)
doc = []
for docstring in docstrings:
if not isinstance(docstring, text_type):
docstring = force_decode(docstring, encoding)
doc.append(prepare_docstring(docstring))
if isinstance(docstring, text_type):
doc.append(prepare_docstring(docstring, ignore))
elif isinstance(docstring, str): # this will not trigger on Py3
doc.append(prepare_docstring(force_decode(docstring, encoding),
ignore))
return doc
def add_content(self, more_content, no_docstring=False):