- changed status to invalid
Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in <type 'exceptions.AttributeError'> ignored
Issue #2428
resolved
This is the sqlalchemy object:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, PickleType
Base = declarative_base()
class Entity(Base):
__tablename__ = 'entitys'
name = Column(String, primary_key=True, nullable = False)
objType = Column(String, nullable = False)
objPickle = Column(PickleType)
def __init__(self, name, objType, objPickle):
self.name = name
self.objType=objType
self.objPickle=objPickle
def __repr__(self):
return "<Entity('%s','%s')>" % (self.name,self.objType)
ObjPickle is something like
Class A(object):
def __init__():
self.objs={}
inside objs there is some objects that inerith from
class AdvancedIneritance(object):
def __init__(self,objInerith):
object.__setattr__(self,'objInerith',objInerith)
def __getattr__(self,name):
"""
overload of the getattr method
"""
try:
return getattr(self.objInerith,name)
except:
try:
return getattr(self,name)
except:
raise AttributeError, name
if i use this tipe of inerithance i get the: Exception RuntimeError: 'maximum recursion depth exceeded in subclasscheck' in <type 'exceptions.AttributeError'> ignored
I made some debug, and I see the the recursion start in this function
def _execute_context(self, dialect, constructor,
statement, parameters,
*args):
"""Create an :class:.ExecutionContext
and execute, returning
a :class:.ResultProxy
."""
try:
try:
conn = self.__connection
except AttributeError:
conn = self._revalidate_connection()
context = constructor(dialect, self, conn, *args) #<--- recursion
except Exception, e:
self._handle_dbapi_exception(e,
str(statement), parameters,
None, None)
raise
Comments (1)
-
repo owner - Log in to comment
Sorry, from what I can see here this is just a problem local to the implementation of non-SQLalchemy classes:
The above simply hangs. This because of the of the recursion caused by
__getattr__()
leading togetattr()
directly. I've added a "print" statement so that you can see it happening.I had to assume this since the code examples posted here are only partial and I had to correct errors such as the missing "self" within
__init__()
. If you need to reopen this ticket, please attach a fully working test case and complete stack trace as per the guidelines at http://www.sqlalchemy.org/participate.html#bugs - thanks !