Issue #362 resolved

[patch] crash at objects that don't have __self__ defined

Anonymous created an issue

Hi, apparently some weird objects don't have self defined at all, leading to crash.

Exception occurred: File "/usr/local/lib/python2.6/dist-packages/Sphinx-1.0dev_20100223-py2.6.egg/sphinx/ext/", line 1005, in import_object self.object.self is not None): AttributeError: 'Boost.Python.function' object has no attribute 'self' The full traceback has been saved in /tmp/sphinx-err-oGPsfh.log, if you want to report the issue to the developers.

I am attaching simple patch that tests attribute presence before looking whether it is None or not.

Comments (4)

  1. Anonymous
    --- a/sphinx/ext/	Tue Mar 16 08:54:03 2010 +0100
    +++ b/sphinx/ext/	Mon Mar 22 11:00:11 2010 +0100
    @@ -1010,6 +1010,7 @@
                 self.member_order = self.member_order - 1
             elif isinstance(self.object, FunctionType) or \
                  (isinstance(self.object, BuiltinFunctionType) and
    +              hasattr(self.object,'__self__') and
                   self.object.__self__ is not None):
                 self.directivetype = 'staticmethod'
                 # document class and static members before ordinary ones
  2. Log in to comment