[issue19030] inspect.getmembers and inspect.classify_class_attrs mishandle descriptors

Nick Coghlan report at bugs.python.org
Mon Sep 16 11:02:46 CEST 2013


Nick Coghlan added the comment:

Right, we definitely want inspect to swallow the exceptions from
descriptors. My suggestion is merely to switch the order to be:
1. Try getattr
2. If that throws an exception, check __dict__ directly
3. If neither works (e.g. due to a buggy __dir__ method), ignore the
attribute entirely.

The problem at the moment is *working* descriptors that are designed to
fall back on the metaclass lookup are being mishandled.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19030>
_______________________________________


More information about the Python-bugs-list mailing list