summaryrefslogtreecommitdiff
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:23:28 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:23:28 +0100
commite19b28f2bd89c047b12f6a8ffb1fe793834700d3 (patch)
tree8261b98b29eedb8ce67df4d571e8ba9b948d17ab /Lib/pydoc.py
parentf7868847da9f84cb68605b4b94d8fcc205e0766e (diff)
parent3eca28c61363a03b81b9fb12775490d6e42d8ecf (diff)
downloadcpython-git-e19b28f2bd89c047b12f6a8ffb1fe793834700d3.tar.gz
Merge branch 'master' into bind-socket
Diffstat (limited to 'Lib/pydoc.py')
-rw-r--r--Lib/pydoc.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index daa7205bd7..86ccfe041f 100644
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -203,6 +203,8 @@ def classify_class_attrs(object):
for (name, kind, cls, value) in inspect.classify_class_attrs(object):
if inspect.isdatadescriptor(value):
kind = 'data descriptor'
+ if isinstance(value, property) and value.fset is None:
+ kind = 'readonly property'
results.append((name, kind, cls, value))
return results
@@ -884,6 +886,8 @@ class HTMLDoc(Doc):
lambda t: t[1] == 'class method')
attrs = spill('Static methods %s' % tag, attrs,
lambda t: t[1] == 'static method')
+ attrs = spilldescriptors("Readonly properties %s" % tag, attrs,
+ lambda t: t[1] == 'readonly property')
attrs = spilldescriptors('Data descriptors %s' % tag, attrs,
lambda t: t[1] == 'data descriptor')
attrs = spilldata('Data and other attributes %s' % tag, attrs,
@@ -993,8 +997,8 @@ class HTMLDoc(Doc):
if name:
push('<dl><dt><strong>%s</strong></dt>\n' % name)
- if object.__doc__ is not None:
- doc = self.markup(getdoc(object), self.preformat)
+ doc = self.markup(getdoc(object), self.preformat)
+ if doc:
push('<dd><tt>%s</tt></dd>\n' % doc)
push('</dl>\n')
@@ -1341,6 +1345,8 @@ location listed above.
lambda t: t[1] == 'class method')
attrs = spill("Static methods %s:\n" % tag, attrs,
lambda t: t[1] == 'static method')
+ attrs = spilldescriptors("Readonly properties %s:\n" % tag, attrs,
+ lambda t: t[1] == 'readonly property')
attrs = spilldescriptors("Data descriptors %s:\n" % tag, attrs,
lambda t: t[1] == 'data descriptor')
attrs = spilldata("Data and other attributes %s:\n" % tag, attrs,