Recover from exceptions in autodoc's isdescriptor function
The line in question is
if hasattr(getattr(x, item, None), '__call__'):
For Paste Registry proxy classes, getattr raises an exception by design if the Paste Registry object has yet to be registered, which it usually isn't in the course of the Sphinx build. (Paste Registry is a thread-safe deferred global WSGI middleware package. You basically assign an empty proxy object to a global and then register it with a real object when the WSGI application is called. Of course, when Sphinx accesses the class, there's no WSGI environment or application to do so.)
Paste Registry, and therefore this uncaught exception, notably occurs in all Pylons applications.
I don't know if this would be acceptable given the fact that getattr usually will never behave this way, but a simple work-around would be to surround the getattr with a try-catch block and simply return False on all exceptions caught.
This seems to be the only problem Paste Registry has with autodoc; after applying this change, Pylons and autodoc seem to get along great. From a cursory glance, I'm guessing it's the only place in the code to actually try and access a class member, and thus the only place to trigger the exception.
Here is a snipped backtrace when autodoc tries to inspect the "url" proxied global in Pylons:
File "[snip]/autodoc.py", line 1019, in can_document_member return (isdescriptor(member) and not File "[snip]/autodoc.py", line 203, in isdescriptor if hasattr(getattr(x, item, None), '__call__'): File "[snip]/paste/registry.py", line 137, in __getattr__ return getattr(self._current_obj(), attr) File "[snip]/paste/registry.py", line 194, in _current_obj 'thread' % self.____name__) TypeError: No object (name: url) has been registered for this thread