[pypy-svn] rev 750 - pypy/trunk/src/pypy/objspace/std
arigo at codespeak.net
arigo at codespeak.net
Thu Jun 5 17:42:08 CEST 2003
Author: arigo
Date: Thu Jun 5 17:42:08 2003
New Revision: 750
Modified:
pypy/trunk/src/pypy/objspace/std/userobject.py
Log:
fixed subclassing problem described in pypy-dev
Modified: pypy/trunk/src/pypy/objspace/std/userobject.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/std/userobject.py (original)
+++ pypy/trunk/src/pypy/objspace/std/userobject.py Thu Jun 5 17:42:08 2003
@@ -30,16 +30,27 @@
space.wrap("instantiating a subtype of a type "
"with a misbehaving constructor"))
- # clone the instance layout into w_self
- w_self.__dict__.update(w_preself.__dict__)
-
# add custom attributes
- w_self.w_uo_type = w_type
- w_self.w_uo_dict = space.newdict([])
- w_self.w_uo_impl_class = w_preself.__class__
+ w_self.__dict__.update(
+ {'w_uo_preself': w_preself,
+ 'w_uo_type': w_type,
+ 'w_uo_dict': space.newdict([]),
+ })
+
+ def __getattr__(w_self, attr):
+ return getattr(w_self.w_uo_preself, attr)
+
+ def __setattr__(w_self, attr, value):
+ if attr in w_self.__dict__:
+ w_self.__dict__[attr] = value
+ else:
+ setattr(w_self.w_preself, attr, value)
+
+ def __delattr__(w_self, attr):
+ raise AttributeError, "we don't wants attribute deletion in RPython"
def get_builtin_impl_class(w_self):
- return w_self.w_uo_impl_class
+ return w_self.w_uo_preself.get_builtin_impl_class()
registerimplementation(W_UserObject)
More information about the Pypy-commit
mailing list