]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed an error in expression typing which caused an endless
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Apr 2010 15:39:09 +0000 (11:39 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 6 Apr 2010 15:39:09 +0000 (11:39 -0400)
loop for expressions with two NULL types.

CHANGES
lib/sqlalchemy/types.py
test/sql/test_types.py

diff --git a/CHANGES b/CHANGES
index cdc860b3757e605313b1d55999910aad249cb54d..2b2b8bd346697f56a669cdafccf243ab415d1320 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -63,6 +63,9 @@ CHANGES
     This includes SQLite, Oracle, Sybase, MS-SQL.
     [ticket:1759]
 
+  - Fixed an error in expression typing which caused an endless
+    loop for expressions with two NULL types.
+    
 - ext
   - the compiler extension now allows @compiles decorators
     on base classes that extend to child classes, @compiles
index dba75b36e2a978303d3b230668a0b268fc89f84e..198835562fad4d52d0f702111ae8cba38ccbf3c0 100644 (file)
@@ -524,7 +524,7 @@ class NullType(TypeEngine):
     __visit_name__ = 'null'
 
     def _adapt_expression(self, op, othertype):
-        if othertype is NullType or not operators.is_commutative(op):
+        if othertype is NULLTYPE or not operators.is_commutative(op):
             return op, self
         else:
             return othertype._adapt_expression(op, self)
index 2186d47d20b6ef3b94070bb9d8dd27e8e384984b..fb9b3912ad9b7efe04cccf879df0881e4c506d60 100644 (file)
@@ -884,6 +884,9 @@ class ExpressionTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
         expr = column('bar', Integer) - 3
         
         eq_(expr.type._type_affinity, Integer)
+
+        expr = bindparam('bar') + bindparam('foo')
+        eq_(expr.type, types.NULLTYPE)
         
     def test_distinct(self):
         s = select([distinct(test_table.c.avalue)])
@@ -894,6 +897,7 @@ class ExpressionTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL):
 
         assert distinct(test_table.c.data).type == test_table.c.data.type
         assert test_table.c.data.distinct().type == test_table.c.data.type
+    
 
 class DateTest(TestBase, AssertsExecutionResults):
     @classmethod