Commits

Mike Bayer committed 927776c

- aaaaand fix one more glitch I just thought of

Comments (0)

Files changed (2)

lib/sqlalchemy/sql/expression.py

         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

test/sql/test_selectable.py

 """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
         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'),