]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
apply the unique __hash__ workaround to all ClauseElements, and only apply it on...
authorPhilip Jenvey <pjenvey@underboss.org>
Wed, 22 Jul 2009 02:35:15 +0000 (02:35 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Wed, 22 Jul 2009 02:35:15 +0000 (02:35 +0000)
fixes #1475

lib/sqlalchemy/sql/expression.py

index 9eb2926e5bdcdc72b134d50c90c740781b94e2d4..6c116e5bc0a38ebb5030253d9799e290a048987c 100644 (file)
@@ -1260,6 +1260,17 @@ class ClauseElement(Visitable):
     def __invert__(self):
         return self._negate()
 
+    if util.jython:
+        def __hash__(self):
+            """Return a distinct hash code.
+
+            ClauseElements may have special equality comparisons which
+            makes us rely on them having unique hash codes for use in
+            hash-based collections. Stock __hash__ doesn't guarantee
+            unique values on platforms with moving GCs.
+            """
+            return id(self)
+
     def _negate(self):
         if hasattr(self, 'negation_clause'):
             return self.negation_clause
@@ -2121,16 +2132,6 @@ class _BindParamClause(ColumnElement):
         d['value'] = v
         return d
 
-    def __hash__(self):
-        """Return a distinct hash code.
-
-        ColumnOperators have special equality comparisons which makes us
-        rely on _BindParamClauses having unique hash codes for use in
-        hash-based collections. Stock __hash__ doesn't guarantee unique
-        values, particularly on platforms with moving GCs.
-        """
-        return id(self)
-
     def __repr__(self):
         return "_BindParamClause(%r, %r, type_=%r)" % (
             self.key, self.value, self.type