From 38d73fb056bef6dec97e88be7e8383a1242a885a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 10 Jan 2014 21:51:51 +0100 Subject: [PATCH] Closes #932: autodoc: Do not crash if ``__doc__`` is not a string. --- CHANGES | 2 ++ sphinx/ext/autodoc.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 6959cb9d7..b5b5d1ee8 100644 --- a/CHANGES +++ b/CHANGES @@ -28,6 +28,8 @@ Bugs fixed * #814: autodoc: Guard against strange type objects that don't have ``__bases__``. +* #932: autodoc: Do not crash if ``__doc__`` is not a string. + Documentation ------------- diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index e26a6b85d..05996f9e5 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -450,9 +450,10 @@ class Documenter(object): # into lines if isinstance(docstring, unicode): return [prepare_docstring(docstring, ignore)] - elif docstring: + elif isinstance(docstring, str): # this will not trigger on Py3 return [prepare_docstring(force_decode(docstring, encoding), ignore)] + # ... else it is something strange, let's ignore it return [] def process_doc(self, docstrings):