Georg Brandl avatar Georg Brandl committed d100662

Fix test_autodoc with Python 3.3, patches by Jon and Takayuki.

Comments (0)

Files changed (2)

sphinx/ext/autodoc.py

     """
     objtype = 'method'
     member_order = 50
-    priority = 0
+    priority = 1  # must be more than FunctionDocumenter
 
     @classmethod
     def can_document_member(cls, member, membername, isattr, parent):

sphinx/util/__init__.py

         except Exception, err:
             raise PycodeError('error importing %r' % modname, err)
     mod = sys.modules[modname]
-    if hasattr(mod, '__loader__'):
+    filename = getattr(mod, '__file__', None)
+    loader = getattr(mod, '__loader__', None)
+    if loader and getattr(loader, 'get_filename', None):
         try:
-            source = mod.__loader__.get_source(modname)
+            filename = loader.get_filename(modname)
+        except Exception, err:
+            raise PycodeError('error getting filename for %r' % filename, err)
+    if filename is None and loader:
+        try:
+            return 'string', loader.get_source(modname)
         except Exception, err:
             raise PycodeError('error getting source for %r' % modname, err)
-        return 'string', source
-    filename = getattr(mod, '__file__', None)
     if filename is None:
         raise PycodeError('no source found for module %r' % modname)
     filename = path.normpath(path.abspath(filename))
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.