summaryrefslogtreecommitdiff
path: root/sphinx/ext/autodoc.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-06 13:03:17 +0100
committerGeorg Brandl <georg@python.org>2011-01-06 13:03:17 +0100
commit86215260458069fdc9b64b58e111540e03f4ff6a (patch)
tree411a458708202d590eada215d2cefe483a3ca205 /sphinx/ext/autodoc.py
parent400e1a7fa8e85acceab6dbde726a44a5e3a5578e (diff)
downloadsphinx-git-86215260458069fdc9b64b58e111540e03f4ff6a.tar.gz
#568: Fix lookup of class attribute documentation on descriptors so that comment documentation now works.
Needed to port assignment of ``self.parent`` from trunk.
Diffstat (limited to 'sphinx/ext/autodoc.py')
-rw-r--r--sphinx/ext/autodoc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py
index 74d25af64..63c263361 100644
--- a/sphinx/ext/autodoc.py
+++ b/sphinx/ext/autodoc.py
@@ -256,6 +256,9 @@ class Documenter(object):
self.retann = None
# the object to document (set after import_object succeeds)
self.object = None
+ self.object_name = None
+ # the parent/owner of the object to document
+ self.parent = None
# the module analyzer to get at attribute docs, or None
self.analyzer = None
@@ -321,9 +324,13 @@ class Documenter(object):
"""
try:
__import__(self.modname)
+ parent = None
obj = self.module = sys.modules[self.modname]
for part in self.objpath:
+ parent = obj
obj = self.get_attr(obj, part)
+ self.object_name = part
+ self.parent = parent
self.object = obj
return True
# this used to only catch SyntaxError, ImportError and AttributeError,
@@ -1065,6 +1072,10 @@ class AttributeDocumenter(ClassLevelDocumenter):
def document_members(self, all_members=False):
pass
+ def get_real_modname(self):
+ return self.get_attr(self.parent or self.object, '__module__', None) \
+ or self.modname
+
class InstanceAttributeDocumenter(AttributeDocumenter):
"""