@@ -203,6 +203,8 @@ def classify_class_attrs(object):
203203 for (name , kind , cls , value ) in inspect .classify_class_attrs (object ):
204204 if inspect .isdatadescriptor (value ):
205205 kind = 'data descriptor'
206+ if isinstance (value , property ) and value .fset is None :
207+ kind = 'readonly property'
206208 results .append ((name , kind , cls , value ))
207209 return results
208210
@@ -884,6 +886,8 @@ def spilldata(msg, attrs, predicate):
884886 lambda t : t [1 ] == 'class method' )
885887 attrs = spill ('Static methods %s' % tag , attrs ,
886888 lambda t : t [1 ] == 'static method' )
889+ attrs = spilldescriptors ("Readonly properties %s:\n " % tag , attrs ,
890+ lambda t : t [1 ] == 'readonly property' )
887891 attrs = spilldescriptors ('Data descriptors %s' % tag , attrs ,
888892 lambda t : t [1 ] == 'data descriptor' )
889893 attrs = spilldata ('Data and other attributes %s' % tag , attrs ,
@@ -1341,6 +1345,8 @@ def spilldata(msg, attrs, predicate):
13411345 lambda t : t [1 ] == 'class method' )
13421346 attrs = spill ("Static methods %s:\n " % tag , attrs ,
13431347 lambda t : t [1 ] == 'static method' )
1348+ attrs = spilldescriptors ("Readonly properties %s:\n " % tag , attrs ,
1349+ lambda t : t [1 ] == 'readonly property' )
13441350 attrs = spilldescriptors ("Data descriptors %s:\n " % tag , attrs ,
13451351 lambda t : t [1 ] == 'data descriptor' )
13461352 attrs = spilldata ("Data and other attributes %s:\n " % tag , attrs ,
0 commit comments