diff --git a/CHANGES b/CHANGES index 16767c362..eae6d5059 100644 --- a/CHANGES +++ b/CHANGES @@ -30,6 +30,8 @@ Bugs fixed Hirai. * #1871: Fix for LaTeX output of tables with one column and multirows. * Work around the lack of the HTMLParserError exception in Python 3.5. +* #1949: Use ``safe_getattr`` in the coverage builder to avoid aborting with + descriptors that have custom behavior. Release 1.3.1 (released Mar 17, 2015) diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py index 8e3ac1ae3..c564aeedd 100644 --- a/sphinx/ext/coverage.py +++ b/sphinx/ext/coverage.py @@ -20,6 +20,7 @@ from six.moves import cPickle as pickle import sphinx from sphinx.builders import Builder +from sphinx.util.inspect import safe_getattr # utility @@ -187,7 +188,10 @@ class CoverageBuilder(Builder): for attr_name in dir(obj): if attr_name not in obj.__dict__: continue - attr = getattr(obj, attr_name) + try: + attr = safe_getattr(obj, attr_name) + except AttributeError: + continue if not (inspect.ismethod(attr) or inspect.isfunction(attr)): continue