[issue19030] inspect.getmembers and inspect.classify_class_attrs mishandle descriptors
Nick Coghlan
report at bugs.python.org
Mon Sep 16 08:18:05 CEST 2013
Nick Coghlan added the comment:
types is the OO equivalent to functools these days, in addition to its original role of exposing the internal type objects that aren't builtins.
However, it seems to me that the fix for issue 1785 is simply *wrong*: it eliminated the exceptions at the expense of sometimes returning the *wrong answer*. The change in that issue means the inspect module isn't implementing the descriptor protocol correctly, and thus may provide a raw descriptor object when attempting to retrieve that attribute will return something else.
Instead of the current behaviour, the inspect module should be trying getattr *first*, and only falling back to peeking in the __dict__ directly if that throws an exception.
----------
title: Make inspect.getmembers and inspect.classify_class_attrs Enum aware -> inspect.getmembers and inspect.classify_class_attrs mishandle descriptors
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19030>
_______________________________________
More information about the Python-bugs-list
mailing list