diff --git a/sphinx/config.py b/sphinx/config.py index 428c0bf40..e1eb8ec8f 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -137,7 +137,7 @@ class Config(object): if name not in self.values: raise AttributeError('No such config value: %s' % name) default = self.values[name][0] - if callable(default): + if hasattr(default, '__call__'): return default(self) return default diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index be3e3f0ff..417eb555c 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -166,7 +166,7 @@ def between(marker, what=None, keepempty=False): def isdescriptor(x): """Check if the object is some kind of descriptor.""" for item in '__get__', '__set__', '__delete__': - if callable(getattr(x, item, None)): + if hasattr(getattr(x, item, None), '__call__'): return True return False diff --git a/tests/test_build.py b/tests/test_build.py index 5e815e889..9999abd0a 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -129,7 +129,7 @@ def test_html(app): for path, check in paths.iteritems(): nodes = list(etree.findall(path)) assert nodes != [] - if callable(check): + if hasattr(check, '__call__'): check(nodes) elif not check: # only check for node presence