New issue 2096: isinstance(obj, cls) should not call __instancecheck__ if
type(obj)==cls
https://bitbucket.org/pypy/pypy/issues/2096/isinstance-obj-cls-should-not-call
kmod:
CPython fast-paths this case to always return true. Seems like probably user
error if instancecheck returns false for instances of that type :P but it's
still a difference:
```
class M(type):
def __instancecheck__(self, obj):
print "instancecheck", type(obj)
return False
class C(object):
__metaclass__ = M
class D(C):
pass
d = D()
print isinstance(d, C) # should call instancecheck
print isinstance(d, D) # should not call instancecheck
```
In the second isinstance(), CPython (2.7.6) doesn't call instancecheck, but
PyPy (2.6.0) does.
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue