Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

> 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.

----------
nosy: +gvanrossum

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45791>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to