From 0d88e4b02058c36820247f9f530feb0ff6fb9d0d Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 9 Dec 2008 23:37:39 +0100 Subject: [PATCH] Fix automethod outside class context. --- CHANGES | 2 ++ sphinx/ext/autodoc.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index f7003992e..20d3f5269 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 0.5.1 (in development) ============================== +* Fix autodoc crash when automethod is used outside a class context. + * Fix LaTeX writer output for images with specified height. * Fix wrong generated image path when including images in sources diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index bb7af93c6..ddaba04cc 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -321,6 +321,9 @@ class RstGenerator(object): # ... or from a class directive if mod_cls is None: mod_cls = self.env.currclass + # ... if still None, there's no way to know + if mod_cls is None: + return fullname, None, [], args, retann mod, cls = rpartition(mod_cls, '.') # if the module name is still missing, get it like above if not mod and hasattr(self.env, 'autodoc_current_module'):