From: Mike Bayer Date: Sat, 18 Aug 2012 05:03:31 +0000 (-0400) Subject: - aaaaand fix one more glitch I just thought of X-Git-Tag: rel_0_8_0b1~229 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=824bd661588d6715d56f279494f98046215b394c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - aaaaand fix one more glitch I just thought of --- diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index e8905ccec5..969a6920b2 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1586,6 +1586,7 @@ class ClauseElement(Visitable): c = self.__class__.__new__(self.__class__) c.__dict__ = self.__dict__.copy() c.__dict__.pop('_cloned_set', None) + c.__dict__.pop('comparator', None) # this is a marker that helps to "equate" clauses to each other # when a Select returns its list of FROM clauses. the cloning diff --git a/test/sql/test_selectable.py b/test/sql/test_selectable.py index 045f6695c3..b81bd8e6fe 100644 --- a/test/sql/test_selectable.py +++ b/test/sql/test_selectable.py @@ -1,7 +1,7 @@ """Test various algorithmic properties of selectables.""" from test.lib.testing import eq_, assert_raises, \ - assert_raises_message + assert_raises_message, is_ from sqlalchemy import * from test.lib import * from sqlalchemy.sql import util as sql_util, visitors @@ -348,6 +348,14 @@ class SelectableTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiled criterion = a.c.table1_col1 == table2.c.col2 self.assert_(criterion.compare(j.onclause)) + def test_scalar_cloned_comparator(self): + sel = select([table1.c.col1]).as_scalar() + expr = sel == table1.c.col1 + + sel2 = visitors.ReplacingCloningVisitor().traverse(sel) + + expr2 = sel2 == table1.c.col1 + is_(expr2.left, sel2) def test_column_labels(self): a = select([table1.c.col1.label('acol1'),