]> granicus.if.org Git - python/commitdiff
In both spilldata() functions, pretend that the docstring for
authorGuido van Rossum <guido@python.org>
Tue, 21 May 2002 20:56:15 +0000 (20:56 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 21 May 2002 20:56:15 +0000 (20:56 +0000)
non-callable objects is always None.  This makes for less confusing
output and fixes the problem reported in SF patch #550290.

Lib/pydoc.py

index de6fc63835ca4560e0b84275fc7e4d5a981dcfa2..4cff5f3a37ae70742483253ff297c41f144591b8 100755 (executable)
@@ -675,7 +675,10 @@ TT { font-family: lucidatypewriter, lucida console, courier }
                 push(msg)
                 for name, kind, homecls, value in ok:
                     base = self.docother(getattr(object, name), name, mod)
-                    doc = getattr(value, "__doc__", None)
+                    if callable(value):
+                        doc = getattr(value, "__doc__", None)
+                    else:
+                        doc = None
                     if doc is None:
                         push('<dl><dt>%s</dl>\n' % base)
                     else:
@@ -1067,7 +1070,10 @@ class TextDoc(Doc):
                 hr.maybe()
                 push(msg)
                 for name, kind, homecls, value in ok:
-                    doc = getattr(value, "__doc__", None)
+                    if callable(value):
+                        doc = getattr(value, "__doc__", None)
+                    else:
+                        doc = None
                     push(self.docother(getattr(object, name),
                                        name, mod, 70, doc) + '\n')
             return attrs