From 02eb04ce6d5cd551024db32edba118f4042851af Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 7 Oct 2002 13:24:02 +0000 Subject: [PATCH] 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. --- Lib/pydoc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 -- 2.47.3