Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5e355b2

Browse files
committed
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.
1 parent 0a8d4d5 commit 5e355b2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/pydoc.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,10 @@ def spilldata(msg, attrs, predicate):
675675
push(msg)
676676
for name, kind, homecls, value in ok:
677677
base = self.docother(getattr(object, name), name, mod)
678-
doc = getattr(value, "__doc__", None)
678+
if callable(value):
679+
doc = getattr(value, "__doc__", None)
680+
else:
681+
doc = None
679682
if doc is None:
680683
push('<dl><dt>%s</dl>\n' % base)
681684
else:
@@ -1067,7 +1070,10 @@ def spilldata(msg, attrs, predicate):
10671070
hr.maybe()
10681071
push(msg)
10691072
for name, kind, homecls, value in ok:
1070-
doc = getattr(value, "__doc__", None)
1073+
if callable(value):
1074+
doc = getattr(value, "__doc__", None)
1075+
else:
1076+
doc = None
10711077
push(self.docother(getattr(object, name),
10721078
name, mod, 70, doc) + '\n')
10731079
return attrs

0 commit comments

Comments
 (0)