Closes #1949: Use `safe_getattr` in the coverage builder to avoid aborting with descriptors that have custom behavior.

This commit is contained in:
Georg Brandl 2015-07-25 09:32:52 +02:00
parent 21188120cc
commit ae7e3afb4f
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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