Closed
Description
Migrated issue, originally created by Anonymous
Introduced in 0.6beta2, present in 0.6.4.
Even though the documentation for schema.Column.init() states that a type's class can be passed for the type if no arguments are required, passing the NullType type (instead of the NULLTYPE instance) results in infinite recursion if both sides of an expression are null-typed.
Minimal reproduction of issue:
import sqlalchemy
qux = sqlalchemy.schema.Column('foo', sqlalchemy.types.NullType) + sqlalchemy.schema.Column('bar', sqlalchemy.types.NullType)
Tail of output:
/var/lib/python-support/python2.5/sqlalchemy/types.py in _adapt_expression(self, op, othertype)
640
641 def _adapt_expression(self, op, othertype):
--> 642 if othertype is NULLTYPE or not operators.is_commutative(op):
643 return op, self
644 else:
<type 'exceptions.RuntimeError'>: maximum recursion depth exceeded
The issue can be fixed by changing the following line in types.py (from the definition of class NullType) from:
if othertype is NULLTYPE or not operators.is_commutative(op):
to:
if type(othertype) == NullType or not operators.is_commutative(op):
(The original failure was due to the Column constructor creating another NullType instance which is not the same instance as types.NULLTYPE, and thus the "is" check fails.)
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
sqlalchemy-bot commentedon Sep 8, 2010
Michael Bayer (@zzzeek) wrote:
seems simple enough, will try to get it for the next go-around, thanks
sqlalchemy-bot commentedon Sep 8, 2010
Changes by Michael Bayer (@zzzeek):
sqlalchemy-bot commentedon Sep 25, 2010
Michael Bayer (@zzzeek) wrote:
a4a09a6
sqlalchemy-bot commentedon Sep 25, 2010
Changes by Michael Bayer (@zzzeek):