From: Guido van Rossum Date: Mon, 7 Oct 2002 13:24:02 +0000 (+0000) Subject: Backport 1.63: X-Git-Tag: v2.2.2b1~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=02eb04ce6d5cd551024db32edba118f4042851af;p=thirdparty%2FPython%2Fcpython.git Backport 1.63: 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. --- diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 7eafe3833df4..b0648be60949 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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('
%s
\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