From: Mike Bayer Date: Tue, 6 Apr 2010 15:39:09 +0000 (-0400) Subject: - Fixed an error in expression typing which caused an endless X-Git-Tag: rel_0_6_0~48^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=67878d13ed95a1caafd9d304c916a3abf0320fb6;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed an error in expression typing which caused an endless loop for expressions with two NULL types. --- diff --git a/CHANGES b/CHANGES index cdc860b375..2b2b8bd346 100644 --- 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 diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index dba75b36e2..198835562f 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -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) diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 2186d47d20..fb9b3912ad 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -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