[pypy-commit] lang-smalltalk default: added a space field to all w_objects with class reference, to enable removing the w_class link in favor of s_class links

lwassermann noreply at buildbot.pypy.org
Wed Apr 3 13:49:05 CEST 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r246:dbcaed2eedea
Date: 2013-04-03 13:47 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/dbcaed2eedea/

Log:	added a space field to all w_objects with class reference, to enable
	removing the w_class link in favor of s_class links removed negative
	arguments from bit_shift primitive to support largepositiveintegers
	and in agreement with original specification

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -330,15 +330,16 @@
 class W_AbstractObjectWithClassReference(W_AbstractObjectWithIdentityHash):
     """Objects with arbitrary class (ie not CompiledMethod, SmallInteger or
     Float)."""
-    _attrs_ = ['w_class', 's_class']
+    _attrs_ = ['w_class', 's_class', 'space']
     s_class = None
 
-    def __init__(self, w_class):
+    def __init__(self, space, w_class):
         if w_class is not None:     # it's None only for testing and space generation
             assert isinstance(w_class, W_PointersObject)
             if w_class.has_shadow():
                 self.s_class = w_class.as_class_get_shadow(w_class._shadow.space)
         self.w_class = w_class
+        self.space = space
 
     def getclass(self, space):
         assert self.w_class is not None
@@ -387,9 +388,9 @@
     _shadow = None # Default value
 
     @jit.unroll_safe
-    def __init__(self, w_class, size):
+    def __init__(self, space, w_class, size):
         """Create new object with size = fixed + variable size."""
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         vars = self._vars = [None] * size
         for i in range(size): # do it by hand for the JIT's sake
             vars[i] = w_nil
@@ -400,6 +401,7 @@
         self.w_class = g_self.get_class()
         self.s_class = None
         self.hash = g_self.get_hash()
+        self.space = space
 
     def at0(self, space, index0):
         # To test, at0 = in varsize part
@@ -476,6 +478,12 @@
         from spyvm.shadow import ClassShadow
         return jit.promote(self.as_special_get_shadow(space, ClassShadow))
 
+    # Should only be used during squeak-image loading.
+    def as_class_get_penumbra(self, space):
+        from spyvm.shadow import ClassShadow
+        self.store_shadow(ClassShadow(space, self))
+        return self._shadow
+
     def as_blockcontext_get_shadow(self, space):
         from spyvm.shadow import BlockContextShadow
         return self.as_special_get_shadow(space, BlockContextShadow)
@@ -521,7 +529,7 @@
         return True
 
     def clone(self, space):
-        w_result = W_PointersObject(self.w_class, len(self._vars))
+        w_result = W_PointersObject(self.space, self.w_class, len(self._vars))
         w_result._vars = [self.fetch(space, i) for i in range(len(self._vars))]
         return w_result
 
@@ -533,8 +541,8 @@
 class W_BytesObject(W_AbstractObjectWithClassReference):
     _attrs_ = ['bytes']
 
-    def __init__(self, w_class, size):
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+    def __init__(self, space, w_class, size):
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         assert isinstance(size, int)
         self.bytes = ['\x00'] * size
 
@@ -542,6 +550,7 @@
         self.w_class = g_self.get_class()
         self.bytes = g_self.get_bytes()
         self.hash = g_self.get_hash()
+        self.space = space
 
     def at0(self, space, index0):
         return space.wrap_int(ord(self.getchar(index0)))
@@ -584,21 +593,22 @@
         return self.bytes == other.bytes
 
     def clone(self, space):
-        w_result = W_BytesObject(self.w_class, len(self.bytes))
+        w_result = W_BytesObject(self.space, self.w_class, len(self.bytes))
         w_result.bytes = list(self.bytes)
         return w_result
 
 class W_WordsObject(W_AbstractObjectWithClassReference):
     _attrs_ = ['words']
 
-    def __init__(self, w_class, size):
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+    def __init__(self, space, w_class, size):
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         self.words = [r_uint(0)] * size
 
     def fillin(self, space, g_self):
         self.words = g_self.get_ruints()
         self.w_class = g_self.get_class()
         self.hash = g_self.get_hash()
+        self.space = space
 
     def at0(self, space, index0):
         val = self.getword(index0)
@@ -622,7 +632,7 @@
                 isinstance(self.words, list))
 
     def clone(self, space):
-        w_result = W_WordsObject(self.w_class, len(self.words))
+        w_result = W_WordsObject(self.space, self.w_class, len(self.words))
         w_result.words = list(self.words)
         return w_result
 
@@ -633,14 +643,14 @@
     _immutable_fields_ = ['_realsize', 'display']
 
     @staticmethod
-    def create(w_class, size, depth, display):
+    def create(space, w_class, size, depth, display):
         if depth == 1:
-            return W_DisplayBitmap1Bit(w_class, size, depth, display)
+            return W_DisplayBitmap1Bit(space, w_class, size, depth, display)
         else:
             raise NotImplementedError("non B/W squeak")
 
-    def __init__(self, w_class, size, depth, display):
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+    def __init__(self, space, w_class, size, depth, display):
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         bytelen = NATIVE_DEPTH / depth * size
         self.pixelbuffer = lltype.malloc(rffi.ULONGP.TO, bytelen, flavor='raw')
         self._realsize = size
@@ -667,7 +677,7 @@
         return False
 
     def clone(self, space):
-        w_result = W_WordsObject(self.w_class, self._realsize)
+        w_result = W_WordsObject(self.space, self.w_class, self._realsize)
         n = 0
         while n < self._realsize:
             w_result.words[n] = self.getword(n)
diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -124,7 +124,7 @@
             w_cinst.store(self, constants.CHARACTER_VALUE_INDEX,
                           model.W_SmallInteger(i))
             return w_cinst
-        w_charactertable = model.W_PointersObject(
+        w_charactertable = model.W_PointersObject(self,
             self.classtable['w_Array'], 256)
         self.w_charactertable = w_charactertable
         for i in range(256):
@@ -135,6 +135,7 @@
         # initialize their fields to nil, we have to create it in the model
         # package, and then patch up its fields here:
         w_nil = self.w_nil = model.w_nil
+        w_nil.space = self
         w_nil.w_class = self.classtable['w_UndefinedObject']
 
         w_true = self.classtable['w_True'].as_class_get_shadow(self).new()
@@ -145,7 +146,7 @@
         self.w_zero = model.W_SmallInteger(0)
         self.w_one = model.W_SmallInteger(1)
         self.w_two = model.W_SmallInteger(2)
-        w_special_selectors = model.W_PointersObject(
+        w_special_selectors = model.W_PointersObject(self,
             self.classtable['w_Array'], len(constants.SPECIAL_SELECTORS) * 2)
         self.w_special_selectors = w_special_selectors
 
@@ -175,9 +176,12 @@
         raise WrappingError("integer too large to fit into a tagged pointer")
 
     def wrap_uint(self, val):
+        from rpython.rlib.objectmodel import we_are_translated
+        if not we_are_translated():
+            assert val <= 0xFFFFFFFF
         if val < 0:
             raise WrappingError("negative integer")
-        if intmask(val) >= 0:
+        if val >= 0:
             try:
                 return self.wrap_positive_32bit_int(intmask(val))
             except WrappingError:
@@ -188,7 +192,8 @@
         if bytes_len <= 4:
             return self.wrap_positive_32bit_int(intmask(val))
         else:
-            w_result = model.W_BytesObject(self.classtable['w_LargePositiveInteger'], bytes_len)
+            w_result = model.W_BytesObject(self, 
+                        self.classtable['w_LargePositiveInteger'], bytes_len)
             for i in range(bytes_len):
                 w_result.setchar(i, chr(intmask((val >> i*8) & 255)))
             return w_result
@@ -327,7 +332,7 @@
 def bootstrap_class(space, instsize, w_superclass=None, w_metaclass=None,
                     name='?', format=shadow.POINTERS, varsized=False):
     from spyvm import model
-    w_class = model.W_PointersObject(w_metaclass, 0)
+    w_class = model.W_PointersObject(space, w_metaclass, 0)
                                              # a dummy placeholder for testing
     # XXX
     s = instantiate(shadow.ClassShadow)
diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -217,7 +217,7 @@
     return interp.space.wrap_int(receiver // argument)
     
 # #bitShift: -- return the shifted value
- at expose_primitive(BIT_SHIFT, unwrap_spec=[int, int])
+ at expose_primitive(BIT_SHIFT, unwrap_spec=[pos_32bit_int, int])
 def func(interp, s_frame, receiver, argument):
 
     # TODO: 1 << 100 will overflow to 0. Catch this gracefully by Primitive
@@ -557,7 +557,7 @@
 @expose_primitive(MOUSE_POINT, unwrap_spec=[object])
 def func(interp, s_frame, w_rcvr):
     x, y = interp.space.get_display().mouse_point()
-    w_point = model.W_PointersObject(interp.space.w_Point, 2)
+    w_point = model.W_PointersObject(interp.space, interp.space.w_Point, 2)
     w_point.store(interp.space, 0, interp.space.wrap_int(x))
     w_point.store(interp.space, 1, interp.space.wrap_int(y))
     return w_point
@@ -620,6 +620,7 @@
         if not sdldisplay:
             sdldisplay = display.SDLDisplay(interp.image_name)
         w_display_bitmap = model.W_DisplayBitmap.create(
+            interp.space,
             w_bitmap.getclass(interp.space),
             w_bitmap.size(),
             depth,
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -201,11 +201,11 @@
     def new(self, extrasize=0):
         w_cls = self.w_self()
         if self.instance_kind == POINTERS:
-            w_new = model.W_PointersObject(w_cls, self.instsize()+extrasize)
+            w_new = model.W_PointersObject(self.space, w_cls, self.instsize()+extrasize)
         elif self.instance_kind == WORDS:
-            w_new = model.W_WordsObject(w_cls, extrasize)
+            w_new = model.W_WordsObject(self.space, w_cls, extrasize)
         elif self.instance_kind == BYTES:
-            w_new = model.W_BytesObject(w_cls, extrasize)
+            w_new = model.W_BytesObject(self.space, w_cls, extrasize)
         elif self.instance_kind == COMPILED_METHOD:
             w_new = model.W_CompiledMethod(extrasize)
         elif self.instance_kind == FLOAT:
@@ -214,7 +214,7 @@
             if extrasize <= 4:
                 w_new = model.W_LargePositiveInteger1Word(0, extrasize)
             else:
-                w_new = model.W_BytesObject(w_cls, extrasize)
+                w_new = model.W_BytesObject(self.space, w_cls, extrasize)
         else:
             raise NotImplementedError(self.instance_kind)
         return w_new
@@ -321,8 +321,8 @@
     def initialize_methoddict(self):
         "NOT_RPYTHON"     # this is only for testing.
         if self._s_methoddict is None:
-            w_methoddict = model.W_PointersObject(None, 2)
-            w_methoddict._store(1, model.W_PointersObject(None, 0))
+            w_methoddict = model.W_PointersObject(self.space, None, 2)
+            w_methoddict._store(1, model.W_PointersObject(self.space, None, 0))
             self._s_methoddict = w_methoddict.as_methoddict_get_shadow(self.space)
             self.s_methoddict().sync_cache()
         self.s_methoddict().invalid = False
@@ -710,7 +710,7 @@
         # into the right places in the W_PointersObject
         # XXX could hack some more to never have to create the _vars of w_result
         contextsize = w_home.as_methodcontext_get_shadow(space).myblocksize()
-        w_result = model.W_PointersObject(space.w_BlockContext, contextsize)
+        w_result = model.W_PointersObject(space, space.w_BlockContext, contextsize)
         s_result = BlockContextShadow(space, w_result)
         s_result_non_fresh = s_result # XXX: find a better solution to translation err
         s_result = jit.hint(s_result, access_directly=True, fresh_virtualizable=True)
diff --git a/spyvm/test/test_interpreter.py b/spyvm/test/test_interpreter.py
--- a/spyvm/test/test_interpreter.py
+++ b/spyvm/test/test_interpreter.py
@@ -94,7 +94,7 @@
     w_method.bytes = bytes
     w_method.argsize=2
     w_method.tempsize=8
-    w_method.setliterals([model.W_PointersObject(None, 2)])
+    w_method.setliterals([model.W_PointersObject(space, None, 2)])
     s_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space, receiver, ["foo", "bar"])
     return s_frame.w_self(), s_frame
 
diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -147,13 +147,13 @@
     with py.test.raises(error.PrimitiveFailedError):
         w_method.atput0(space, 9, space.wrap_int(5))
 
-def test_is_same_object(w_o1=model.W_PointersObject(None,0), w_o2=None):
+def test_is_same_object(w_o1=model.W_PointersObject(space, None,0), w_o2=None):
     if w_o2 is None:
         w_o2 = w_o1
     assert w_o1.is_same_object(w_o2)
     assert w_o2.is_same_object(w_o1)
     
-def test_not_is_same_object(w_o1=model.W_PointersObject(None,0),w_o2=model.W_PointersObject(None,0)):
+def test_not_is_same_object(w_o1=model.W_PointersObject(space, None,0),w_o2=model.W_PointersObject(space, None,0)):
     assert not w_o1.is_same_object(w_o2)
     assert not w_o2.is_same_object(w_o1)
     w_o2 = model.W_SmallInteger(2)
@@ -221,7 +221,7 @@
 
 def test_word_atput():
     i = model.W_SmallInteger(100)
-    b = model.W_WordsObject(None, 1)
+    b = model.W_WordsObject(space, None, 1)
     b.atput0(space, 0, i)
     assert 100 == b.getword(0)
     i = space.classtable['w_LargePositiveInteger'].as_class_get_shadow(space).new(4)
@@ -230,7 +230,7 @@
     assert b.getword(0) == 3221225472
 
 def test_word_at():
-    b = model.W_WordsObject(None, 1)
+    b = model.W_WordsObject(space, None, 1)
     b.setword(0, 100)
     r = b.at0(space, 0)
     assert isinstance(r, model.W_SmallInteger)
@@ -238,7 +238,7 @@
 
     b.setword(0, 3221225472)
     r = b.at0(space, 0)
-    assert isinstance(r, model.W_BytesObject)
+    assert isinstance(r, (model.W_BytesObject, model.W_LargePositiveInteger1Word))
     assert r.size() == 4
 
 def test_float_at():
@@ -288,7 +288,7 @@
     assert hex(r_uint(target.value)) == hex(r_uint(source.value))
 
 def test_display_bitmap():
-    target = model.W_DisplayBitmap.create(space.w_Array, 100, 1, None)
+    target = model.W_DisplayBitmap.create(space, space.w_Array, 100, 1, None)
     target.setword(0, 0xFF00)
     assert bin(target.getword(0)) == bin(0xFF00)
     target.setword(0, 0x00FF00FF)
diff --git a/spyvm/test/test_objectspace.py b/spyvm/test/test_objectspace.py
--- a/spyvm/test/test_objectspace.py
+++ b/spyvm/test/test_objectspace.py
@@ -28,6 +28,7 @@
     assert w_Metaclass.w_class.w_class is w_Metaclass
 
 def test_ruint():
+    from spyvm import model
     """
     | a b |
     a := (9223372036854775808).
@@ -40,7 +41,7 @@
     """
 
     from rpython.rlib.rarithmetic import r_uint
-    for num in [0, 1, 41, 100, 2**31, sys.maxint + 1]:
+    for num in [0, 1, 41, 100, 2**31, sys.maxint + 1, -1]:
         num = r_uint(num)
         assert space.unwrap_uint(space.wrap_uint(num)) == num
     for num in [-1, -100, -sys.maxint]:
@@ -49,9 +50,10 @@
     for obj in [space.wrap_char('a'), space.wrap_int(-1)]:
         with py.test.raises(objspace.UnwrappingError):
             space.unwrap_uint(obj)
-    byteobj = space.wrap_uint(sys.maxint + 1)
-    byteobj.bytes.append('\x01')
-    num = space.unwrap_uint(byteobj)
+    # byteobj = space.wrap_uint(0x100000000)
+    # assert isinstance(byteobj, model.W_BytesObject)
+    # byteobj.bytes.append('\x01')
+    # num = space.unwrap_uint(byteobj)
     # should not raise. see docstring.
   
 
diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py
--- a/spyvm/test/test_primitives.py
+++ b/spyvm/test/test_primitives.py
@@ -157,6 +157,7 @@
     assert prim(primitives.BIT_SHIFT, [4, 27]).value == 536870912
     
 def test_small_int_bit_shift_negative():
+    py.test.skip("While this would make sense, because of the specification, we dont shift negative numbers")
     assert prim(primitives.BIT_SHIFT, [-4, -3]).value == -1
     assert prim(primitives.BIT_SHIFT, [-4, -2]).value == -1
     assert prim(primitives.BIT_SHIFT, [-4, -1]).value == -2
@@ -444,12 +445,15 @@
     import time
     now = int(time.time())
     w_smalltalk_now1 = prim(primitives.SECONDS_CLOCK, [42])
-    assert (now % 256 - ord(w_smalltalk_now1.bytes[0])) % 256 <= 2
     w_smalltalk_now2 = prim(primitives.SECONDS_CLOCK, [42])
-    # the high-order byte should only change by one (and even that is
-    # extreeemely unlikely)
-    assert (ord(w_smalltalk_now2.bytes[-1]) - ord(w_smalltalk_now1.bytes[-1])) <= 1
-
+    # the test now is flaky, because we assume both have the same type
+    if isinstance(w_smalltalk_now1, model.W_BytesObject):
+        assert (now % 256 - ord(w_smalltalk_now1.bytes[0])) % 256 <= 2
+        # the high-order byte should only change by one (and even that is
+        # extreeemely unlikely)
+        assert (ord(w_smalltalk_now2.bytes[-1]) - ord(w_smalltalk_now1.bytes[-1])) <= 1
+    else:
+        assert w_smalltalk_now2.value - w_smalltalk_now1.value <= 1
 
 def test_load_inst_var():
     " try to test the LoadInstVar primitives a little "
@@ -635,8 +639,8 @@
 
 def test_primitive_be_display():
     assert space.objtable["w_display"] is None
-    mock_display = model.W_PointersObject(space.w_Point, 4)
-    w_wordbmp = model.W_WordsObject(space.w_Array, 100)
+    mock_display = model.W_PointersObject(space, space.w_Point, 4)
+    w_wordbmp = model.W_WordsObject(space, space.w_Array, 100)
     mock_display.store(space, 0, w_wordbmp) # bitmap
     mock_display.store(space, 1, space.wrap_int(32)) # width
     mock_display.store(space, 2, space.wrap_int(10)) # height
@@ -649,8 +653,8 @@
     sdldisplay = w_bitmap.display
     assert isinstance(sdldisplay, display.SDLDisplay)
 
-    mock_display2 = model.W_PointersObject(space.w_Point, 4)
-    mock_display2.store(space, 0, model.W_WordsObject(space.w_Array, 100)) # bitmap
+    mock_display2 = model.W_PointersObject(space, space.w_Point, 4)
+    mock_display2.store(space, 0, model.W_WordsObject(space, space.w_Array, 100)) # bitmap
     mock_display2.store(space, 1, space.wrap_int(32)) # width
     mock_display2.store(space, 2, space.wrap_int(10)) # height
     mock_display2.store(space, 3, space.wrap_int(1))  # depth
@@ -667,8 +671,8 @@
     assert mock_display.fetch(space, 0) is w_bitmap
 
 def test_primitive_force_display_update(monkeypatch):
-    mock_display = model.W_PointersObject(space.w_Point, 4)
-    w_wordbmp = model.W_WordsObject(space.w_Array, 100)
+    mock_display = model.W_PointersObject(space, space.w_Point, 4)
+    w_wordbmp = model.W_WordsObject(space, space.w_Array, 100)
     mock_display.store(space, 0, w_wordbmp) # bitmap
     mock_display.store(space, 1, space.wrap_int(32)) # width
     mock_display.store(space, 2, space.wrap_int(10)) # height
@@ -695,7 +699,7 @@
         def __init__(self):
             self.w_simulateCopyBits = "simulateCopyBits"
 
-    mock_bitblt = model.W_PointersObject(space.w_Point, 15)
+    mock_bitblt = model.W_PointersObject(space, space.w_Point, 15)
 
     def perform_mock(w_selector, argcount, interp):
         if w_selector == "simulateCopyBits" or w_selector.as_string() == "simulateCopyBits":
diff --git a/spyvm/test/test_shadow.py b/spyvm/test/test_shadow.py
--- a/spyvm/test/test_shadow.py
+++ b/spyvm/test/test_shadow.py
@@ -36,7 +36,7 @@
                                                w_Metaclass)
     w_methoddict = build_methoddict(methods)
     size = constants.CLASS_NAME_INDEX + 1
-    w_class = model.W_PointersObject(w_classofclass, size)
+    w_class = model.W_PointersObject(space, w_classofclass, size)
     w_class.store(space, constants.CLASS_SUPERCLASS_INDEX, w_superclass)
     w_class.store(space, constants.CLASS_METHODDICT_INDEX, w_methoddict)
     w_class.store(space, constants.CLASS_FORMAT_INDEX, space.wrap_int(format))
@@ -85,7 +85,7 @@
 
 def methodcontext(w_sender=space.w_nil, pc=1, stackpointer=0, stacksize=5,
                   method=method()):
-    w_object = model.W_PointersObject(space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+method.tempsize+stacksize)
+    w_object = model.W_PointersObject(space, space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+method.tempsize+stacksize)
     w_object.store(space, constants.CTXPART_SENDER_INDEX, w_sender)
     w_object.store(space, constants.CTXPART_PC_INDEX, space.wrap_int(pc))
     w_object.store(space, constants.CTXPART_STACKP_INDEX, space.wrap_int(method.tempsize+stackpointer))
@@ -99,7 +99,7 @@
 
 def blockcontext(w_sender=space.w_nil, pc=1, stackpointer=1, stacksize=5,
                   home=methodcontext()):
-    w_object = model.W_PointersObject(space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+stacksize)
+    w_object = model.W_PointersObject(space, space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+stacksize)
     w_object.store(space, constants.CTXPART_SENDER_INDEX, w_sender)
     w_object.store(space, constants.CTXPART_PC_INDEX, space.wrap_int(pc))
     w_object.store(space, constants.CTXPART_STACKP_INDEX, space.wrap_int(stackpointer))
diff --git a/spyvm/test/test_wrapper.py b/spyvm/test/test_wrapper.py
--- a/spyvm/test/test_wrapper.py
+++ b/spyvm/test/test_wrapper.py
@@ -10,7 +10,7 @@
     return new_frame_tuple("")[0]
 
 def test_simpleread():
-    w_o = model.W_PointersObject(None, 2)
+    w_o = model.W_PointersObject(space, None, 2)
     w = wrapper.Wrapper(space, w_o)
     w_o._vars[0] = "hello"
     assert w.read(0) == "hello"
@@ -20,7 +20,7 @@
     py.test.raises(WrapperException, "w.write(2, \"test\")")
 
 def test_accessor_generators():
-    w_o = model.W_PointersObject(None, 1)
+    w_o = model.W_PointersObject(space, None, 1)
     w = wrapper.LinkWrapper(space, w_o)
     w_o._vars[0] = "hello"
     assert w.next_link() == "hello"
@@ -28,12 +28,12 @@
     assert w.next_link() == "boe"
 
 def link(w_next='foo'):
-    w_object = model.W_PointersObject(None, 1)
+    w_object = model.W_PointersObject(space, None, 1)
     wrapper.LinkWrapper(space, w_object).store_next_link(w_next)
     return w_object
 
 def test_linked_list():
-    w_object = model.W_PointersObject(None,2)
+    w_object = model.W_PointersObject(space, None,2)
     w_last = link(space.w_nil)
     w_lb1 = link(w_last)
     w_lb2 = link(w_lb1)
@@ -72,7 +72,7 @@
                 w_suspended_context=space.w_nil,
                 priority=0):
     w_priority = space.wrap_int(priority)
-    w_process = model.W_PointersObject(None, 4)
+    w_process = model.W_PointersObject(space, None, 4)
     process = wrapper.ProcessWrapper(space, w_process)
     process.store_next_link(w_next)
     process.store_my_list(w_my_list)
@@ -81,7 +81,7 @@
     return process
 
 def new_processlist(processes_w=[]):
-    w_processlist = model.W_PointersObject(None, 2)
+    w_processlist = model.W_PointersObject(space, None, 2)
     w_first = space.w_nil
     w_last = space.w_nil
     for w_process in processes_w[::-1]:
@@ -99,7 +99,7 @@
     else:
         maxpriority = 5
         prioritydict = {}
-    w_prioritylist = model.W_PointersObject(None, maxpriority)
+    w_prioritylist = model.W_PointersObject(space, None, maxpriority)
     prioritylist = wrapper.Wrapper(space, w_prioritylist)
     for i in range(maxpriority):
         prioritylist.write(i, new_processlist(prioritydict.get(i, []))._w_self)
@@ -108,14 +108,14 @@
 
 def new_scheduler(w_process=space.w_nil, prioritydict=None):
     priority_list = new_prioritylist(prioritydict)
-    w_scheduler = model.W_PointersObject(None, 2)
+    w_scheduler = model.W_PointersObject(space, None, 2)
     scheduler = wrapper.SchedulerWrapper(space, w_scheduler)
     scheduler.store_active_process(w_process)
     scheduler.write(0, priority_list._w_self)
     return scheduler
 
 def new_semaphore(excess_signals=0):
-    w_semaphore = model.W_PointersObject(None, 3)
+    w_semaphore = model.W_PointersObject(space, None, 3)
     semaphore = wrapper.SemaphoreWrapper(space, w_semaphore)
     semaphore.store_excess_signals(excess_signals)
     return semaphore


More information about the pypy-commit mailing list