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 rhettinger
Recipients gvanrossum, rhettinger, serhiy.storchaka
Date 2021-11-12.08:07:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> As in most (but not all) cases of dunder methods it
> is looked up in a class, ignoring instance attributes.

That is true, but the starting point in this case is a class so the attribute lookup should be in that class, not its metaclass.

Guido's original code was correct and it became broken in 3.1 in the switch from PyObject_GetAttr(cls, name) to _PyObject_LookupSpecial(cls, &PyId___instancecheck__).

Also, the demonstration code I gave (that matches the documentation) used to work in 3.0 and prior.  It broken in 3.1.
Date User Action Args
2021-11-12 08:07:36rhettingersetrecipients: + rhettinger, gvanrossum, serhiy.storchaka
2021-11-12 08:07:36rhettingersetmessageid: <>
2021-11-12 08:07:36rhettingerlinkissue45791 messages
2021-11-12 08:07:36rhettingercreate