[issue2325] isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead of returning False

Matias Gonzalez report at bugs.python.org
Sat Jun 21 20:34:14 CEST 2008

Matias Gonzalez <gonzalezmatias at gmail.com> added the comment:

This is not a bug. Function __instancecheck__ should be a classmethod.

>>> class Meta(type):
...     @classmethod
...     def __instancecheck__(self, other):
...             return False
>>> isinstance(3, Meta)

nosy: +mato2000

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list