Message199697
Part of the issue 19030 patch was incorrect and we missed it in the review. Specifically, the else clause in this bit:
try:
get_obj = getattr(cls, name)
except Exception as exc:
pass
else:
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:33 | ncoghlan | set | recipients:
+ ncoghlan, arigo, ronaldoussoren, eli.bendersky, ethan.furman, eric.snow |
2013-10-13 11:53:32 | ncoghlan | set | messageid: <1381665212.97.0.573533388435.issue16938@psf.upfronthosting.co.za> |
2013-10-13 11:53:32 | ncoghlan | link | issue16938 messages |
2013-10-13 11:53:32 | ncoghlan | create | |
|