This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: __subclasscheck__ : class P(M): __metaclass__=M causes maximum recursion depth exceeded.
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Trundle, xBrawny
Priority: normal Keywords:

Created on 2011-04-06 06:33 by xBrawny, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg133110 - (view) Author: (xBrawny) Date: 2011-04-06 06:33
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
msg133277 - (view) Author: Andreas Stührk (Trundle) * Date: 2011-04-07 23:53
That issue is already fixed in 2.7 and 3.x (by ae006386ec39). Also, it's a duplicate of issue #2325, hence I think this one can be closed.
History
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 55987
2011-04-08 00:39:12benjamin.petersonsetstatus: open -> closed
resolution: out of date
2011-04-07 23:53:49Trundlesetnosy: + Trundle
messages: + msg133277
2011-04-06 06:33:00xBrawnycreate