[pypy-svn] r68462 - pypy/branch/gc-hash/pypy/annotation

arigo at codespeak.net arigo at codespeak.net
Wed Oct 14 19:14:59 CEST 2009


Author: arigo
Date: Wed Oct 14 19:14:58 2009
New Revision: 68462

Modified:
   pypy/branch/gc-hash/pypy/annotation/dictdef.py
Log:
Kill the flag is_r_dict, which was mostly redundant:
the flag custom_eq_hash has the same meaning (but is
a bit messily changed, so kill that).


Modified: pypy/branch/gc-hash/pypy/annotation/dictdef.py
==============================================================================
--- pypy/branch/gc-hash/pypy/annotation/dictdef.py	(original)
+++ pypy/branch/gc-hash/pypy/annotation/dictdef.py	Wed Oct 14 19:14:58 2009
@@ -6,11 +6,12 @@
 
 
 class DictKey(ListItem):
-    custom_eq_hash = False
+    s_rdict_eqfn = s_ImpossibleValue
+    s_rdict_hashfn = s_ImpossibleValue
 
     def __init__(self, bookkeeper, s_value, is_r_dict=False):
         ListItem.__init__(self, bookkeeper, s_value)
-        self.is_r_dict = is_r_dict
+        self.custom_eq_hash = is_r_dict
 
     def patch(self):
         for dictdef in self.itemof:
@@ -33,11 +34,9 @@
         return updated
 
     def update_rdict_annotations(self, s_eqfn, s_hashfn, other=None):
-        if not self.custom_eq_hash:
-            self.custom_eq_hash = True
-        else:
-            s_eqfn = unionof(s_eqfn, self.s_rdict_eqfn)
-            s_hashfn = unionof(s_hashfn, self.s_rdict_hashfn)
+        assert self.custom_eq_hash
+        s_eqfn = unionof(s_eqfn, self.s_rdict_eqfn)
+        s_hashfn = unionof(s_hashfn, self.s_rdict_hashfn)
         self.s_rdict_eqfn = s_eqfn
         self.s_rdict_hashfn = s_hashfn
         self.emulate_rdict_calls(other=other)
@@ -137,7 +136,7 @@
         # Note that if the custom hashing function ends up asking for
         # the hash of x, then it must use compute_hash() itself, so it
         # works out.
-        if not self.dictkey.is_r_dict:
+        if not self.dictkey.custom_eq_hash:
             compute_hash(x)
 
     def __repr__(self):



More information about the Pypy-commit mailing list