Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r75610:aa776127acf6
Date: 2015-01-31 16:03 +0100
http://bitbucket.org/pypy/pypy/changeset/aa776127acf6/

Log:    Fix this broken logic (duh!). If TLS.hash_level is missing it is
        assumed to be zero, but then we must also check self.__cached_hash.

diff --git a/rpython/rtyper/lltypesystem/lltype.py 
b/rpython/rtyper/lltypesystem/lltype.py
--- a/rpython/rtyper/lltypesystem/lltype.py
+++ b/rpython/rtyper/lltypesystem/lltype.py
@@ -141,13 +141,15 @@
         # NB. the __cached_hash should neither be used nor updated
         # if we enter with hash_level > 0, because the computed
         # __hash__ can be different in this situation.
-        hash_level = 0
         try:
             hash_level = TLS.nested_hash_level
-            if hash_level == 0:
+        except AttributeError:
+            hash_level = 0
+        if hash_level == 0:
+            try:
                 return self.__cached_hash
-        except AttributeError:
-            pass
+            except AttributeError:
+                pass
         if hash_level >= 3:
             return 0
         items = self.__dict__.items()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to