On Oct 28, 2011, at 7:09 PM, Burak Arslan wrote:
>
>> Here's how to reproduce:
>>
>> from sqlalchemy import *
>> from sqlalchemy.ext.declarative import declarative_base
>>
>> Base= declarative_base()
>>
>> class A(Base):
>> __tablename__ = "a"
>>
>> id = Column(Integer, primary_key=True)
>>
>> class B(A):
>> # this just means, "dont map the class".
>> # A is mapped but B is not
>> __abstract__ = True
>>
>> B._sa_class_manager = A._sa_class_manager
>> B()
>>
>>
>
>
> um, this doesn't crash at all here, are you sure you didn't miss something ?
> i can do a "print B()"
>
> <__main__.B object at 0x030C7C10>
I get a recursion loop, matching your paste, as follows:
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/instrumentation.py",
line 307, in _new_state_if_none
_new_state_if_none(instance)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/instrumentation.py",
line 307, in _new_state_if_none
_new_state_if_none(instance)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/instrumentation.py",
line 306, in _new_state_if_none
return self._subclass_manager(instance.__class__).\
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/instrumentation.py",
line 135, in _subclass_manager
manager = manager_of_class(cls)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/instrumentation.py",
line 609, in manager_of_class
return cls.__dict__.get(ClassManager.MANAGER_ATTR, None)
RuntimeError: maximum recursion depth exceeded while calling a Python object
so if that's not working, here are you steps:
1. ensure you're using the latest tip of SQLAlchemy.
2. place this code:
import pdb
pdb.set_trace()
at line 301 of the file sqlalchemy/orm/instrumentation.py
3. run your program. the pdb will be reached
4. check that self.class_ and instance.__class__ are the same. If not, yet
they share the same _sa_class_state variable in cls.__dict__, this is the bug,
which results in the recursion overflow. SQLAlchemy does not create this class
so not sure how two are existing. The overhead of rpclib and others make this
test case too complex for me to quickly see a bug on the SQLAlchemy side - if
you can reduce the issue down to a purely SQLAlchemy, single file test case, I
can consider a potential bug on the SQLA side. At the moment, it still appears
like some kind of class manipulation is going on to cause this.
>
> this can be all i need to track down this problem.
>
> thank you for your time.
>
> best regards,
> burak
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.