[pypy-svn] r54934 - in pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk: . test

tverwaes at codespeak.net tverwaes at codespeak.net
Mon May 19 15:35:08 CEST 2008


Author: tverwaes
Date: Mon May 19 15:35:07 2008
New Revision: 54934

Modified:
   pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/model.py
   pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/shadow.py
   pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_model.py
Log:
(cfbolz, tverwaes) also swapping shadows in become of W_PointersObject


Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/model.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/model.py	(original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/model.py	Mon May 19 15:35:07 2008
@@ -302,6 +302,7 @@
         if not isinstance(w_other, W_PointersObject):
             return False
         self._vars, w_other._vars = w_other._vars, self._vars
+        self._shadow, w_other._shadow = w_other._shadow, self._shadow
         return W_AbstractObjectWithClassReference.become(self, w_other)
         
 

Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/shadow.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/shadow.py	(original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/shadow.py	Mon May 19 15:35:07 2008
@@ -152,6 +152,7 @@
 
     def guess_class_name(self):
         w_self = self.w_self()
+        w_name = None
 
         # read the name
         if w_self.size() > constants.CLASS_NAME_INDEX:

Modified: pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_model.py
==============================================================================
--- pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_model.py	(original)
+++ pypy/branch/smalltalk-shadow-changes/pypy/lang/smalltalk/test/test_model.py	Mon May 19 15:35:07 2008
@@ -187,3 +187,13 @@
 
     assert w_b.fetch(0) is w_b
     assert w_a.fetch(1) is w_a
+
+def test_become_with_shadow():
+    w_clsa = mockclass(3)
+    s_clsa = w_clsa.as_class_get_shadow()
+    w_clsb = mockclass(4)
+    s_clsb = w_clsb.as_class_get_shadow()
+    res = w_clsa.become(w_clsb)
+    assert res
+    assert w_clsa.as_class_get_shadow() is s_clsb
+    assert w_clsb.as_class_get_shadow() is s_clsa



More information about the Pypy-commit mailing list