This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients eric.snow
Date 2013-08-21.19:51:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377114694.59.0.675744683781.issue18801@psf.upfronthosting.co.za>
In-reply-to
Content
>>> pprint.pprint(inspect.classify_class_attrs(object))
[Attribute(name='__class__', kind='data', defining_class=<class 'object'>, object=<attribute '__class__' of 'object' objects>),
...
 Attribute(name='__init__', kind='method', defining_class=<class 'object'>, object=<slot wrapper '__init__' of 'object' objects>),
...
 Attribute(name='__new__', kind='data', defining_class=<class 'object'>, object=<built-in method __new__ of type object at 0x8aee20>),
...
]

I haven't had a chance to look into why __new__() falls through the cracks but expect it's due to how __new__() is treated like a staticmethod without being one.  I suppose there could be other similar cases, but __new__() is probably the only oddball here.

An extra test using isbuiltin() fixes this.

         else:
             obj_via_getattr = getattr(cls, name)
             if (ismethod(obj_via_getattr) or
-                ismethoddescriptor(obj_via_getattr)):
+                ismethoddescriptor(obj_via_getattr) or
+                isbuiltin(obj_via_getattr)):
                 kind = "method"
             else:
                 kind = "data"
History
Date User Action Args
2013-08-21 19:51:34eric.snowsetrecipients: + eric.snow
2013-08-21 19:51:34eric.snowsetmessageid: <1377114694.59.0.675744683781.issue18801@psf.upfronthosting.co.za>
2013-08-21 19:51:34eric.snowlinkissue18801 messages
2013-08-21 19:51:34eric.snowcreate