[pypy-svn] r14478 - pypy/branch/pypy-translation-snapshot/interpreter
pedronis at codespeak.net
pedronis at codespeak.net
Sun Jul 10 23:59:09 CEST 2005
Author: pedronis
Date: Sun Jul 10 23:59:05 2005
New Revision: 14478
Modified:
pypy/branch/pypy-translation-snapshot/interpreter/baseobjspace.py
pypy/branch/pypy-translation-snapshot/interpreter/typedef.py
Log:
merge slots reorg.
Modified: pypy/branch/pypy-translation-snapshot/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/interpreter/baseobjspace.py (original)
+++ pypy/branch/pypy-translation-snapshot/interpreter/baseobjspace.py Sun Jul 10 23:59:05 2005
@@ -51,6 +51,12 @@
id = r_uint(id) # XXX what about sizeof(void*) > sizeof(long) !!
return space.wrap("<%s at 0x%x>" % (info, id))
+ def getslotvalue(self, index):
+ raise NotImplementedError
+
+ def setslotvalue(self, index, w_val):
+ raise NotImplementedError
+
class BaseWrappable(W_Root):
"""A subclass of BaseWrappable is an internal, interpreter-level class
that can nevertheless be exposed at application-level by space.wrap()."""
Modified: pypy/branch/pypy-translation-snapshot/interpreter/typedef.py
==============================================================================
--- pypy/branch/pypy-translation-snapshot/interpreter/typedef.py (original)
+++ pypy/branch/pypy-translation-snapshot/interpreter/typedef.py Sun Jul 10 23:59:05 2005
@@ -89,6 +89,12 @@
if wants_slots:
def user_setup_slots(self, nslots):
self.slots_w = [None] * nslots
+
+ def setslotvalue(self, index, w_value):
+ self.slots_w[index] = w_value
+
+ def getslotvalue(self, index):
+ return self.slots_w[index]
else:
def user_setup_slots(self, nslots):
assert nslots == 0
@@ -273,7 +279,7 @@
else:
self = member
self.typecheck(space, w_obj)
- w_result = w_obj.slots_w[self.index]
+ w_result = w_obj.getslotvalue(self.index)
if w_result is None:
raise OperationError(space.w_AttributeError,
space.wrap(self.name)) # XXX better message
@@ -284,14 +290,14 @@
Write into the slot 'member' of the given 'obj'."""
self = member
self.typecheck(space, w_obj)
- w_obj.slots_w[self.index] = w_value
+ w_obj.setslotvalue(self.index, w_value)
def descr_member_del(space, member, w_obj):
"""member.__delete__(obj)
Delete the value of the slot 'member' from the given 'obj'."""
self = member
self.typecheck(space, w_obj)
- w_obj.slots_w[self.index] = None
+ w_obj.setslotvalue(self.index, None)
Member.typedef = TypeDef(
"Member",
More information about the Pypy-commit
mailing list