[sqlalchemy] Re: Infinite loop in SA

2009-11-11 Thread Mike Conley
That is pretty much what I expected. Considering it only occurs if the
developer writes incorrect code, I wouldn't want to make the performance
tradeoff.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Infinite loop in SA

2009-11-11 Thread Michael Bayer

Mike Conley wrote:
> I ran across this when writing some new code. I incorrectly appended
> something to a relation and sent SA 0.5.6 off into an infinite loop until
> max recursion depth was reached.
>
> Obviously this is a coding bug on my part, but is it also a bug in SA that
> should be fixed? I don't have access to 0.6 right now to see if the
> problem
> is there also.
>
>
> class A(Base):
> __tablename__ = 'a'
> a_id = Column(Integer, primary_key=True)
>
> class B(Base):
> __tablename__ = 'b'
> b_id = Column(Integer, primary_key=True)
> a_id = Column(Integer, ForeignKey('a.a_id'))
> a = relation('A', backref='b')
>
> a=A()
> b=B()
> x={22:33} # does not loop if dictionary is empty
> a.b.append(b, x)   # <-- goes into infinite loop, should be a.b.append(b)
> which works OK
>
>

that's an artifact of the collection instrumentation.   We could add a
check to verify the type of argument there but it would add overhead to a
pretty critical section.It might be something to revisit down the road
if we ever had time to overhaul collections another time but not much can
be done right now.





> --
> Mike Conley
>
> >
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---