]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- this is small optimization, currently it's the best we can do
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Aug 2014 16:41:50 +0000 (12:41 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 28 Aug 2014 16:41:50 +0000 (12:41 -0400)
for #3175.  fixes #3175 (for now)

lib/sqlalchemy/sql/annotation.py

index 02f5c3c1c472932bb2c8eb99a317591ca717e528..3df4257d45a743f1cba27483214e34be551ee771 100644 (file)
@@ -46,6 +46,7 @@ class Annotated(object):
         self.__dict__ = element.__dict__.copy()
         self.__element = element
         self._annotations = values
+        self._hash = hash(element)
 
     def _annotate(self, values):
         _values = self._annotations.copy()
@@ -87,7 +88,7 @@ class Annotated(object):
             return self.__class__(clone, self._annotations)
 
     def __hash__(self):
-        return hash(self.__element)
+        return self._hash
 
     def __eq__(self, other):
         if isinstance(self.__element, operators.ColumnOperators):