[pypy-svn] r62716 - pypy/trunk/pypy/rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Sat Mar 7 17:01:13 CET 2009


Author: arigo
Date: Sat Mar  7 17:01:11 2009
New Revision: 62716

Modified:
   pypy/trunk/pypy/rpython/lltypesystem/rclass.py
Log:
Revert a part of a checkin that accidentally undid a bug fix.


Modified: pypy/trunk/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rclass.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rclass.py	Sat Mar  7 17:01:11 2009
@@ -415,17 +415,16 @@
         else:
             return self.rbase.get_ll_hash_function()
 
-    def initialize_prebuilt_instance(self, value, classdef, result):
+    def initialize_prebuilt_data(self, value, classdef, result):
         if self.classdef is not None:
             # recursively build the parent part of the instance
-            self.rbase.initialize_prebuilt_instance(value, classdef,
-                                                    result.super)
+            self.rbase.initialize_prebuilt_data(value, classdef, result.super)
             # then add instance attributes from this level
             for name, (mangled_name, r) in self.fields.items():
                 if r.lowleveltype is Void:
                     llattrvalue = None
                 elif name == '_hash_cache_': # hash() support
-                    llattrvalue = hash(value)
+                    continue   # already done by initialize_prebuilt_hash()
                 else:
                     try:
                         attrvalue = getattr(value, name)
@@ -445,6 +444,14 @@
             rclass = getclassrepr(self.rtyper, classdef)
             result.typeptr = rclass.getvtable()
 
+    def initialize_prebuilt_hash(self, value, result):
+        if self.classdef is not None:
+            self.rbase.initialize_prebuilt_hash(value, result.super)
+            if '_hash_cache_' in self.fields:
+                mangled_name, r = self.fields['_hash_cache_']
+                llattrvalue = hash(value)
+                setattr(result, mangled_name, llattrvalue)
+
     def getfieldrepr(self, attr):
         """Return the repr used for the given attribute."""
         if attr in self.fields:



More information about the Pypy-commit mailing list