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 ncoghlan
Recipients arigo, eli.bendersky, eric.snow, ethan.furman, ncoghlan, ronaldoussoren
Date 2013-10-13.11:53:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Part of the issue 19030 patch was incorrect and we missed it in the review. Specifically, the else clause in this bit:

                get_obj = getattr(cls, name)
            except Exception as exc:
                homecls = getattr(get_obj, "__class__")
                homecls = getattr(get_obj, "__objclass__", homecls)
                if homecls not in possible_bases:
                    # if the resulting object does not live somewhere in the
                    # mro, drop it and go with the dict_obj version only
                    homecls = None
                    get_obj = sentinel

The restriction that the __class__ of the object returned by a descriptor must appear in the MRO doesn't make any sense. The entire else block should be simplified to just:

    homecls = getattr(get_obj, "__objclass__", None)

And a "defining class" of None should be documented as a possible result for dynamic attributes that appear in __dir__ but don't set __objclass__ appropriately, and don't correspond to a descriptor.
Date User Action Args
2013-10-13 11:53:33ncoghlansetrecipients: + ncoghlan, arigo, ronaldoussoren, eli.bendersky, ethan.furman, eric.snow
2013-10-13 11:53:32ncoghlansetmessageid: <>
2013-10-13 11:53:32ncoghlanlinkissue16938 messages
2013-10-13 11:53:32ncoghlancreate