]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 1.63:
authorGuido van Rossum <guido@python.org>
Mon, 7 Oct 2002 13:24:02 +0000 (13:24 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 7 Oct 2002 13:24:02 +0000 (13:24 +0000)
In both spilldata() functions, pretend that the docstring for
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 7eafe3833df45f641e1d6ccd2d6bbcf6b19d1bd3..b0648be60949f710dac0e4b646afe93527256614 100755 (executable)
@@ -674,7 +674,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:
@@ -1066,7 +1069,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