diff options
author | Georg Brandl <georg@python.org> | 2015-07-25 09:32:52 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2015-07-25 09:33:09 +0200 |
commit | ae7e3afb4faaf616aa8042e86c1da3a8aebea3af (patch) | |
tree | 572e89bf38066be727b513610aa2e81f4f0db4c9 /sphinx/ext/coverage.py | |
parent | 21188120cc86e51654230988cfc39847d910a27a (diff) | |
download | sphinx-git-ae7e3afb4faaf616aa8042e86c1da3a8aebea3af.tar.gz |
Closes #1949: Use ``safe_getattr`` in the coverage builder to avoid aborting with descriptors that have custom behavior.
Diffstat (limited to 'sphinx/ext/coverage.py')
-rw-r--r-- | sphinx/ext/coverage.py | 6 |
1 files changed, 5 insertions, 1 deletions
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 |