[pypy-commit] lang-smalltalk default: fixed a bug when creating nameless classes and using them (Behavior new new)

lwassermann noreply at buildbot.pypy.org
Wed Jun 26 12:52:54 CEST 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r477:eb1af4f5f97f
Date: 2013-06-26 12:51 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/eb1af4f5f97f/

Log:	fixed a bug when creating nameless classes and using them (Behavior
	new new)

diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -187,10 +187,12 @@
             # metaclasses hold a pointer to the real class in the last
             # slot. This is pos 6 in mini.image and higher in squeak3.9
             w_realclass = w_self._fetch(w_self.size() - 1)
-            assert isinstance(w_realclass, model.W_PointersObject)
-            if w_realclass.size() > constants.CLASS_NAME_INDEX:
+            if (isinstance(w_realclass, model.W_PointersObject)
+                and w_realclass.size() > constants.CLASS_NAME_INDEX):
                 # TODO ADD TEST WHICH GOES OVER THIS PART
                 w_name = w_realclass._fetch(constants.CLASS_NAME_INDEX)
+            else:
+                return
 
         if isinstance(w_name, model.W_BytesObject):
             self.name = w_name.as_string()


More information about the pypy-commit mailing list