New submission from Jeffrey Yasskin <[EMAIL PROTECTED]>:

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

In 2.6, this results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: maximum recursion depth exceeded while calling a Python object
(That's a recursion in C, through PyObject_IsInstance and
instancemethod_call)

In 3.0, I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __instancecheck__() takes exactly 2 positional arguments (1
given)

----------
components: Interpreter Core
messages: 63671
nosy: jyasskin
severity: normal
status: open
title: isinstance(anything, MetaclassThatDefinesInstancecheck) raises instead 
of returning False
type: behavior
versions: Python 2.6, Python 3.0

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2325>
__________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to