[pypy-svn] r76815 - pypy/branch/better-map-instances/pypy/interpreter

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Sep 1 17:50:59 CEST 2010


Author: cfbolz
Date: Wed Sep  1 17:50:57 2010
New Revision: 76815

Modified:
   pypy/branch/better-map-instances/pypy/interpreter/typedef.py
Log:
(arigo, cfbolz): be a bit more object-oriented and don't just copy the code from
the base user_setup


Modified: pypy/branch/better-map-instances/pypy/interpreter/typedef.py
==============================================================================
--- pypy/branch/better-map-instances/pypy/interpreter/typedef.py	(original)
+++ pypy/branch/better-map-instances/pypy/interpreter/typedef.py	Wed Sep  1 17:50:57 2010
@@ -271,6 +271,9 @@
             wantdict = False
 
     if wantdict:
+        base_user_setup = supercls.user_setup.im_func
+        if "user_setup" in body:
+            base_user_setup = body["user_setup"]
         class Proto(object):
             def getdict(self):
                 return self.w__dict__
@@ -279,11 +282,9 @@
                 self.w__dict__ = check_new_dictionary(space, w_dict)
             
             def user_setup(self, space, w_subtype):
-                self.space = space
-                self.w__class__ = w_subtype
                 self.w__dict__ = space.newdict(
                     instance=True, classofinstance=w_subtype)
-                self.user_setup_slots(w_subtype.nslots)
+                base_user_setup(self, space, w_subtype)
 
             def setclass(self, space, w_subtype):
                 # only used by descr_set___class__



More information about the Pypy-commit mailing list