[pypy-svn] r62519 - pypy/branch/spy-graphic/pypy/lang/smalltalk
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Mar 4 13:28:40 CET 2009
Author: cfbolz
Date: Wed Mar 4 13:28:39 2009
New Revision: 62519
Modified:
pypy/branch/spy-graphic/pypy/lang/smalltalk/model.py
pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py
Log:
Fix bug in cloning: When the cloned object has a shadow, we need to be careful.
Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/model.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/model.py (original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/model.py Wed Mar 4 13:28:39 2009
@@ -99,7 +99,7 @@
False means swapping failed"""
return False
- def clone(self):
+ def clone(self, space):
raise NotImplementedError
class W_SmallInteger(W_Object):
@@ -139,7 +139,7 @@
def __hash__(self):
return self.value
- def clone(self):
+ def clone(self, space):
return self
class W_Float(W_Object):
@@ -177,7 +177,7 @@
def __hash__(self):
return hash(self.value)
- def clone(self):
+ def clone(self, space):
return self
class W_AbstractObjectWithIdentityHash(W_Object):
@@ -352,9 +352,9 @@
W_AbstractObjectWithClassReference._become(self, w_other)
return True
- def clone(self):
+ def clone(self, space):
w_result = W_PointersObject(self.w_class, len(self._vars))
- w_result._vars[:] = self._vars
+ w_result._vars = [self.fetch(space, i) for i in range(len(self._vars))]
return w_result
class W_BytesObject(W_AbstractObjectWithClassReference):
@@ -401,9 +401,9 @@
return False
return self.bytes == other.bytes
- def clone(self):
+ def clone(self, space):
w_result = W_BytesObject(self.w_class, len(self.bytes))
- w_result.bytes[:] = self.bytes
+ w_result.bytes = list(self.bytes)
return w_result
class W_WordsObject(W_AbstractObjectWithClassReference):
@@ -432,9 +432,9 @@
return (W_AbstractObjectWithClassReference.invariant(self) and
isinstance(self.words, list))
- def clone(self):
+ def clone(self, space):
w_result = W_WordsObject(self.w_class, len(self.words))
- w_result.words[:] = self.words
+ w_result.words = list(self.words)
return w_result
# XXX Shouldn't compiledmethod have class reference for subclassed compiled
Modified: pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py (original)
+++ pypy/branch/spy-graphic/pypy/lang/smalltalk/primitives.py Wed Mar 4 13:28:39 2009
@@ -614,7 +614,7 @@
@expose_primitive(CLONE, unwrap_spec=[object])
def func(interp, w_arg):
- return w_arg.clone()
+ return w_arg.clone(interp.space)
#____________________________________________________________________________
# Time Primitives
More information about the Pypy-commit
mailing list