[New-bugs-announce] [issue11778] __subclasscheck__ : class P(M): __metaclass__=M causes maximum recursion depth exceeded.

xBrawny report at bugs.python.org
Wed Apr 6 08:33:01 CEST 2011


New submission from xBrawny <andrei at newthot.com>:

I wonder if this is the desired behavior. According to docs, __instancecheck__ should be called,  but it never gets to it. If "return True" is replaced with "raise Exception" the result is the same.
=========================================
class M(type):
    def __instancecheck__(cls,obj):
        return True
    
class P(M):
    __metaclass__=M

isinstance(object,P)
========================================
    isinstance(object,P)
RuntimeError: maximum recursion depth exceeded while calling a Python object

----------
components: Interpreter Core
messages: 133110
nosy: xBrawny
priority: normal
severity: normal
status: open
title: __subclasscheck__ :  class P(M): __metaclass__=M causes maximum recursion depth exceeded.
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11778>
_______________________________________


More information about the New-bugs-announce mailing list