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

Anonymous avatarAnonymous 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/autodoc.py", 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 (3)

  1. Anonymous
    --- a/sphinx/ext/autodoc.py	Tue Mar 16 08:54:03 2010 +0100
    +++ b/sphinx/ext/autodoc.py	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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.