From ae7e3afb4faaf616aa8042e86c1da3a8aebea3af Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 25 Jul 2015 09:32:52 +0200 Subject: Closes #1949: Use ``safe_getattr`` in the coverage builder to avoid aborting with descriptors that have custom behavior. --- sphinx/ext/coverage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sphinx/ext/coverage.py') 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 -- cgit v1.2.1