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 ethan.furman
Recipients arigo, eli.bendersky, eric.snow, ethan.furman, ncoghlan, ronaldoussoren
Date 2013-10-13.14:45:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
'None' is not an appropriate response to the "Where does this attribute come from" question.  For one, it's wrong.  For two, it breaks help.

The current patch fixes that particular problem (as a last resort it walks the mro looking for the last class that reported having the attribute, and returns that class as the home class).

The reason it has the __class__, __objclass__ two-step in there was to handle cases like Enum members that do have __class__ set correctly and do not have __objclass__ set at all as it was falsely reporting the home class in that case as None.

Nick Coughlan said:
> The restriction that the __class__ of the object returned by a descriptor
> must appear in the MRO doesn't make any sense.

In the context of finding the home class it does:  if the __class__ returned by a descriptor is not in the mro then just like None it 1) is wrong (it doesn't reflect how it came it be in the class being looked up), and 2) it gives weird results in help.

The added tests in the patch may shed more light if my explanation isn't making sense.
Date User Action Args
2013-10-13 14:45:13ethan.furmansetrecipients: + ethan.furman, arigo, ronaldoussoren, ncoghlan, eli.bendersky, eric.snow
2013-10-13 14:45:13ethan.furmansetmessageid: <>
2013-10-13 14:45:13ethan.furmanlinkissue16938 messages
2013-10-13 14:45:13ethan.furmancreate