[pypy-svn] r26840 - in pypy/dist/pypy/objspace/std: . test

arigo at codespeak.net arigo at codespeak.net
Sat May 6 00:06:00 CEST 2006


Author: arigo
Date: Sat May  6 00:05:47 2006
New Revision: 26840

Modified:
   pypy/dist/pypy/objspace/std/boolobject.py
   pypy/dist/pypy/objspace/std/complexobject.py
   pypy/dist/pypy/objspace/std/complextype.py
   pypy/dist/pypy/objspace/std/default.py
   pypy/dist/pypy/objspace/std/dictobject.py
   pypy/dist/pypy/objspace/std/dictproxyobject.py
   pypy/dist/pypy/objspace/std/fake.py
   pypy/dist/pypy/objspace/std/floatobject.py
   pypy/dist/pypy/objspace/std/floattype.py
   pypy/dist/pypy/objspace/std/frozensettype.py
   pypy/dist/pypy/objspace/std/intobject.py
   pypy/dist/pypy/objspace/std/inttype.py
   pypy/dist/pypy/objspace/std/iterobject.py
   pypy/dist/pypy/objspace/std/listobject.py
   pypy/dist/pypy/objspace/std/listtype.py
   pypy/dist/pypy/objspace/std/longobject.py
   pypy/dist/pypy/objspace/std/longtype.py
   pypy/dist/pypy/objspace/std/marshal_impl.py
   pypy/dist/pypy/objspace/std/model.py
   pypy/dist/pypy/objspace/std/multimethod.py
   pypy/dist/pypy/objspace/std/noneobject.py
   pypy/dist/pypy/objspace/std/objecttype.py
   pypy/dist/pypy/objspace/std/objspace.py
   pypy/dist/pypy/objspace/std/setobject.py
   pypy/dist/pypy/objspace/std/settype.py
   pypy/dist/pypy/objspace/std/sliceobject.py
   pypy/dist/pypy/objspace/std/slicetype.py
   pypy/dist/pypy/objspace/std/stringobject.py
   pypy/dist/pypy/objspace/std/stringtype.py
   pypy/dist/pypy/objspace/std/test/test_complexobject.py
   pypy/dist/pypy/objspace/std/test/test_floatobject.py
   pypy/dist/pypy/objspace/std/test/test_intobject.py
   pypy/dist/pypy/objspace/std/test/test_iterobject.py
   pypy/dist/pypy/objspace/std/test/test_listobject.py
   pypy/dist/pypy/objspace/std/test/test_longobject.py
   pypy/dist/pypy/objspace/std/test/test_multimethod.py
   pypy/dist/pypy/objspace/std/test/test_sliceobject.py
   pypy/dist/pypy/objspace/std/test/test_tupleobject.py
   pypy/dist/pypy/objspace/std/tupleobject.py
   pypy/dist/pypy/objspace/std/tupletype.py
   pypy/dist/pypy/objspace/std/typeobject.py
   pypy/dist/pypy/objspace/std/unicodeobject.py
   pypy/dist/pypy/objspace/std/unicodetype.py
Log:
Just for fun, or maybe to try to win the largest diff award:
refactored the StdObjSpace to no longer store the 'space'
attribute on any of the W_XxxObject classes.  It was not
really used in any essential way any more.


Modified: pypy/dist/pypy/objspace/std/boolobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/boolobject.py	(original)
+++ pypy/dist/pypy/objspace/std/boolobject.py	Sat May  6 00:05:47 2006
@@ -1,12 +1,11 @@
 from pypy.objspace.std.objspace import *
-from pypy.objspace.std import intobject
+from pypy.objspace.std.inttype import wrapint
 
 
 class W_BoolObject(W_Object):
     from pypy.objspace.std.booltype import bool_typedef as typedef
 
-    def __init__(w_self, space, boolval):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, boolval):
         w_self.boolval = not not boolval
 
     def __nonzero__(w_self):
@@ -16,15 +15,15 @@
         """ representation for debugging purposes """
         return "%s(%s)" % (w_self.__class__.__name__, w_self.boolval)
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         return w_self.boolval
 
 registerimplementation(W_BoolObject)
 
 # bool-to-int delegation requires translating the .boolvar attribute
 # to an .intval one
-def delegate_Bool2Int(w_bool):
-    return intobject.W_IntObject(w_bool.space, int(w_bool.boolval))
+def delegate_Bool2Int(space, w_bool):
+    return wrapint(int(w_bool.boolval))
 
 
 def nonzero__Bool(space, w_bool):

Modified: pypy/dist/pypy/objspace/std/complexobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/complexobject.py	(original)
+++ pypy/dist/pypy/objspace/std/complexobject.py	Sat May  6 00:05:47 2006
@@ -13,8 +13,7 @@
 
     from pypy.objspace.std.complextype import complex_typedef as typedef
 
-    def __init__(w_self, space, realval=0.0, imgval=0.0):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, realval=0.0, imgval=0.0):
         w_self.realval = float(realval)
         w_self.imagval = float(imgval)
 
@@ -111,25 +110,21 @@
 
 
 
-def delegate_Bool2Complex(w_bool):
-    space = w_bool.space
-    return W_ComplexObject(space, w_bool.boolval, 0.0)
-
-def delegate_Int2Complex(w_int):
-    space = w_int.space
-    return W_ComplexObject(space, w_int.intval, 0.0)
+def delegate_Bool2Complex(space, w_bool):
+    return W_ComplexObject(w_bool.boolval, 0.0)
 
-def delegate_Long2Complex(w_long):
-    space = w_long.space
+def delegate_Int2Complex(space, w_int):
+    return W_ComplexObject(w_int.intval, 0.0)
+
+def delegate_Long2Complex(space, w_long):
     try:
         dval =  _AsDouble(w_long)
     except OverflowError, e:
         raise OperationError(space.w_OverflowError, space.wrap(str(e)))
-    return W_ComplexObject(space, dval, 0.0)
+    return W_ComplexObject(dval, 0.0)
 
-def delegate_Float2Complex(w_float):
-    space = w_float.space
-    return W_ComplexObject(space, w_float.floatval, 0.0)
+def delegate_Float2Complex(space, w_float):
+    return W_ComplexObject(w_float.floatval, 0.0)
 
 def hash__Complex(space, w_value):
     #this is straight out of CPython complex implementation
@@ -151,7 +146,7 @@
     return w_complex.realval, w_complex.imagval
 
 def _t2w(space, c):
-    return W_ComplexObject(space, c[0], c[1])
+    return W_ComplexObject(c[0], c[1])
 
 def add__Complex_Complex(space, w_complex1, w_complex2):
     return _t2w(space, _sum(_w2t(space, w_complex1), _w2t(space, w_complex2)))
@@ -218,11 +213,11 @@
 
 def neg__Complex(space, w_complex):
     assert space.is_true(space.isinstance(w_complex, space.w_complex))
-    return W_ComplexObject(space, -w_complex.realval, -w_complex.imagval)
+    return W_ComplexObject(-w_complex.realval, -w_complex.imagval)
 
 def pos__Complex(space, w_complex):
     assert space.is_true(space.isinstance(w_complex, space.w_complex))
-    return W_ComplexObject(space, w_complex.realval, w_complex.imagval)
+    return W_ComplexObject(w_complex.realval, w_complex.imagval)
 
 def abs__Complex(space, w_complex):
     assert space.is_true(space.isinstance(w_complex, space.w_complex))

Modified: pypy/dist/pypy/objspace/std/complextype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/complextype.py	(original)
+++ pypy/dist/pypy/objspace/std/complextype.py	Sat May  6 00:05:47 2006
@@ -168,7 +168,7 @@
         realval = space.float_w(w_real)
         imagval = space.float_w(w_imag)
     w_obj = space.allocate_instance(W_ComplexObject, w_complextype)
-    W_ComplexObject.__init__(w_obj, space, realval, imagval)
+    W_ComplexObject.__init__(w_obj, realval, imagval)
 
     return w_obj
 

Modified: pypy/dist/pypy/objspace/std/default.py
==============================================================================
--- pypy/dist/pypy/objspace/std/default.py	(original)
+++ pypy/dist/pypy/objspace/std/default.py	Sat May  6 00:05:47 2006
@@ -8,8 +8,8 @@
 
 def id__ANY(space, w_obj):
     #print 'id:', w_obj
-    from pypy.objspace.std import intobject
-    return intobject.W_IntObject(space, id(w_obj))
+    from pypy.objspace.std.inttype import wrapint
+    return wrapint(id(w_obj))
 
 # __init__ should succeed if called internally as a multimethod
 

Modified: pypy/dist/pypy/objspace/std/dictobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictobject.py	(original)
+++ pypy/dist/pypy/objspace/std/dictobject.py	Sat May  6 00:05:47 2006
@@ -15,7 +15,6 @@
     from pypy.objspace.std.dicttype import dict_typedef as typedef
 
     def __init__(w_self, space, w_otherdict=None):
-        W_Object.__init__(w_self, space)
         if w_otherdict is None:
             w_self.content = r_dict(space.eq_w, space.hash_w)
         else:
@@ -29,8 +28,7 @@
         """ representation for debugging purposes """
         return "%s(%s)" % (w_self.__class__.__name__, w_self.content)
 
-    def unwrap(w_dict):
-        space = w_dict.space
+    def unwrap(w_dict, space):
         result = {}
         for w_key, w_value in w_dict.content.items():
             # generic mixed types unwrap
@@ -43,7 +41,7 @@
 def init__Dict(space, w_dict, __args__):
     w_src, w_kwds = __args__.parse('dict',
                           (['seq_or_map'], None, 'kwargs'), # signature
-                          [W_DictObject(space)])        # default argument
+                          [W_DictObject(space)])            # default argument
     w_dict.content.clear()
     try:
         space.getattr(w_src, space.wrap("keys"))
@@ -216,7 +214,7 @@
     from pypy.objspace.std.dicttype import dictiter_typedef as typedef
 
     def __init__(w_self, space, w_dictobject):
-        W_Object.__init__(w_self, space)
+        w_self.space = space
         w_self.content = content = w_dictobject.content
         w_self.len = len(content)
         w_self.pos = 0

Modified: pypy/dist/pypy/objspace/std/dictproxyobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dictproxyobject.py	(original)
+++ pypy/dist/pypy/objspace/std/dictproxyobject.py	Sat May  6 00:05:47 2006
@@ -1,13 +1,12 @@
 from pypy.objspace.std.objspace import *
 
 def descr_get_dictproxy(space, w_obj):
-    return W_DictProxyObject(space, w_obj.getdict())
+    return W_DictProxyObject(w_obj.getdict())
 
 class W_DictProxyObject(W_Object):
     from pypy.objspace.std.dictproxytype import dictproxy_typedef as typedef
     
-    def __init__(w_self, space, w_dict):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, w_dict):
         w_self.w_dict = w_dict
 
 registerimplementation(W_DictProxyObject)

Modified: pypy/dist/pypy/objspace/std/fake.py
==============================================================================
--- pypy/dist/pypy/objspace/std/fake.py	(original)
+++ pypy/dist/pypy/objspace/std/fake.py	Sat May  6 00:05:47 2006
@@ -114,9 +114,8 @@
         typedef = StdTypeDef(
             cpy_type.__name__, base, **kw)
         def __init__(w_self, space, val):
-            W_Object.__init__(w_self, space)
             w_self.val = val
-        def unwrap(w_self):
+        def unwrap(w_self, space):
             return w_self.val
                 
     # cannot write to W_Fake.__name__ in Python 2.2!

Modified: pypy/dist/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floatobject.py	(original)
+++ pypy/dist/pypy/objspace/std/floatobject.py	Sat May  6 00:05:47 2006
@@ -20,11 +20,10 @@
        an argument"""
     from pypy.objspace.std.floattype import float_typedef as typedef
     
-    def __init__(w_self, space, floatval):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, floatval):
         w_self.floatval = floatval
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         return w_self.floatval
 
     def __repr__(self):
@@ -33,20 +32,20 @@
 registerimplementation(W_FloatObject)
 
 # bool-to-float delegation
-def delegate_Bool2Float(w_bool):
-    return W_FloatObject(w_bool.space, float(w_bool.boolval))
+def delegate_Bool2Float(space, w_bool):
+    return W_FloatObject(float(w_bool.boolval))
 
 # int-to-float delegation
-def delegate_Int2Float(w_intobj):
-    return W_FloatObject(w_intobj.space, float(w_intobj.intval))
+def delegate_Int2Float(space, w_intobj):
+    return W_FloatObject(float(w_intobj.intval))
 
 # long-to-float delegation
-def delegate_Long2Float(w_longobj):
+def delegate_Long2Float(space, w_longobj):
     try:
-        return W_FloatObject(w_longobj.space, _AsDouble(w_longobj))
+        return W_FloatObject(_AsDouble(w_longobj))
     except OverflowError:
-        raise OperationError(w_longobj.space.w_OverflowError,
-                             w_longobj.space.wrap("long int too large to convert to float"))
+        raise OperationError(space.w_OverflowError,
+                             space.wrap("long int too large to convert to float"))
 
 
 # float__Float is supposed to do nothing, unless it has
@@ -56,7 +55,7 @@
     if space.is_w(space.type(w_float1), space.w_float):
         return w_float1
     a = w_float1.floatval
-    return W_FloatObject(space, a)
+    return W_FloatObject(a)
 
 def int__Float(space, w_value):
     try:
@@ -248,7 +247,7 @@
         z = x + y
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float addition"))
-    return W_FloatObject(space, z)
+    return W_FloatObject(z)
 
 def sub__Float_Float(space, w_float1, w_float2):
     x = w_float1.floatval
@@ -257,7 +256,7 @@
         z = x - y
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float substraction"))
-    return W_FloatObject(space, z)
+    return W_FloatObject(z)
 
 def mul__Float_Float(space, w_float1, w_float2):
     x = w_float1.floatval
@@ -266,7 +265,7 @@
         z = x * y
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float multiplication"))
-    return W_FloatObject(space, z)
+    return W_FloatObject(z)
 
 def div__Float_Float(space, w_float1, w_float2):
     x = w_float1.floatval
@@ -278,7 +277,7 @@
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float division"))
     # no overflow
-    return W_FloatObject(space, z)
+    return W_FloatObject(z)
 
 truediv__Float_Float = div__Float_Float
 
@@ -303,7 +302,7 @@
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float division"))
 
-    return W_FloatObject(space, mod)
+    return W_FloatObject(mod)
 
 def _divmod_w(space, w_float1, w_float2):
     x = w_float1.floatval
@@ -343,7 +342,7 @@
     except FloatingPointError:
         raise FailedToImplement(space.w_FloatingPointError, space.wrap("float division"))
 
-    return [W_FloatObject(space, floordiv), W_FloatObject(space, mod)]
+    return [W_FloatObject(floordiv), W_FloatObject(mod)]
 
 def divmod__Float_Float(space, w_float1, w_float2):
     return space.newtuple(_divmod_w(space, w_float1, w_float2))
@@ -384,17 +383,17 @@
         except ValueError:
             raise FailedToImplement(space.w_ValueError, space.wrap("float power")) # xxx
 
-    return W_FloatObject(space, z)
+    return W_FloatObject(z)
 
 
 def neg__Float(space, w_float1):
-    return W_FloatObject(space, -w_float1.floatval)
+    return W_FloatObject(-w_float1.floatval)
 
 def pos__Float(space, w_float):
     return float__Float(space, w_float)
 
 def abs__Float(space, w_float):
-    return W_FloatObject(space, abs(w_float.floatval))
+    return W_FloatObject(abs(w_float.floatval))
 
 def nonzero__Float(space, w_float):
     return space.newbool(w_float.floatval != 0.0)
@@ -405,13 +404,13 @@
     if w_float.__class__ == W_FloatObject:
         return w_float
     else:
-        return W_FloatObject(space, w_float.floatval)
+        return W_FloatObject(w_float.floatval)
 
 StdObjSpace.coerce.register(float_coerce, W_FloatObject)
 """
 
 def getnewargs__Float(space, w_float):
-    return space.newtuple([W_FloatObject(space, w_float.floatval)])
+    return space.newtuple([W_FloatObject(w_float.floatval)])
 
 def log__Float(space, w_float, base):
     # base is supposed to be positive or 0.0, which means we use e
@@ -430,15 +429,15 @@
 
 # pow delegation for negative 2nd arg
 def pow_neg__Long_Long_None(space, w_int1, w_int2, thirdarg):
-    w_float1 = delegate_Long2Float(w_int1)
-    w_float2 = delegate_Long2Float(w_int2)
+    w_float1 = delegate_Long2Float(space, w_int1)
+    w_float2 = delegate_Long2Float(space, w_int2)
     return pow__Float_Float_ANY(space, w_float1, w_float2, thirdarg)
 
 StdObjSpace.MM.pow.register(pow_neg__Long_Long_None, W_LongObject, W_LongObject, W_NoneObject, order=1)
 
 def pow_neg__Int_Int_None(space, w_int1, w_int2, thirdarg):
-    w_float1 = delegate_Int2Float(w_int1)
-    w_float2 = delegate_Int2Float(w_int2)
+    w_float1 = delegate_Int2Float(space, w_int1)
+    w_float2 = delegate_Int2Float(space, w_int2)
     return pow__Float_Float_ANY(space, w_float1, w_float2, thirdarg)
 
 StdObjSpace.MM.pow.register(pow_neg__Int_Int_None, W_IntObject, W_IntObject, W_NoneObject, order=2)

Modified: pypy/dist/pypy/objspace/std/floattype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/floattype.py	(original)
+++ pypy/dist/pypy/objspace/std/floattype.py	Sat May  6 00:05:47 2006
@@ -36,7 +36,7 @@
                           # whatever x.__float__() returned
         value = space.float_w(w_obj)
     w_obj = space.allocate_instance(W_FloatObject, w_floattype)
-    W_FloatObject.__init__(w_obj, space, value)
+    W_FloatObject.__init__(w_obj, value)
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/frozensettype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/frozensettype.py	(original)
+++ pypy/dist/pypy/objspace/std/frozensettype.py	Sat May  6 00:05:47 2006
@@ -23,7 +23,7 @@
     if _is_frozenset_exact(w_iterable):
         return w_iterable
     w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype)
-    W_FrozensetObject.__init__(w_obj, space, None)
+    W_FrozensetObject.__init__(w_obj, None)
 
     return w_obj
 

Modified: pypy/dist/pypy/objspace/std/intobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/intobject.py	(original)
+++ pypy/dist/pypy/objspace/std/intobject.py	Sat May  6 00:05:47 2006
@@ -1,6 +1,7 @@
 from pypy.objspace.std.objspace import *
 from pypy.objspace.std.noneobject import W_NoneObject
 from pypy.rpython.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT, r_uint
+from pypy.objspace.std.inttype import wrapint
 
 """
 In order to have the same behavior running
@@ -12,15 +13,14 @@
 class W_IntObject(W_Object):
     from pypy.objspace.std.inttype import int_typedef as typedef
     
-    def __init__(w_self, space, intval):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, intval):
         w_self.intval = intval
 
     def __repr__(w_self):
         """ representation for debugging purposes """
         return "%s(%d)" % (w_self.__class__.__name__, w_self.intval)
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         return int(w_self.intval)
 
 
@@ -53,22 +53,6 @@
 
 str__Int = repr__Int
 
-## deprecated
-## we are going to support rich compare, only
-
-##def int_int_cmp(space, w_int1, w_int2):
-##    i = w_int1.intval
-##    j = w_int2.intval
-##    if i < j:
-##        ret = -1
-##    elif i > j:
-##        ret = 1
-##    else:
-##        ret = 0
-##    return W_IntObject(space, ret)
-##
-##StdObjSpace.cmp.register(int_int_cmp, W_IntObject, W_IntObject)
-
 def lt__Int_Int(space, w_int1, w_int2):
     i = w_int1.intval
     j = w_int2.intval
@@ -118,7 +102,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer addition"))
-    return W_IntObject(space, z)
+    return wrapint(z)
 
 def sub__Int_Int(space, w_int1, w_int2):
     x = w_int1.intval
@@ -128,7 +112,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer substraction"))
-    return W_IntObject(space, z)
+    return wrapint(z)
 
 def mul__Int_Int(space, w_int1, w_int2):
     x = w_int1.intval
@@ -138,7 +122,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer multiplication"))
-    return W_IntObject(space, z)
+    return wrapint(z)
 
 def _floordiv(space, w_int1, w_int2):
     x = w_int1.intval
@@ -151,7 +135,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer division"))
-    return W_IntObject(space, z)
+    return wrapint(z)
 
 def _truediv(space, w_int1, w_int2):
     # XXX how to do delegation to float elegantly?
@@ -172,7 +156,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer modulo"))
-    return W_IntObject(space, z)
+    return wrapint(z)
 
 def divmod__Int_Int(space, w_int1, w_int2):
     x = w_int1.intval
@@ -224,7 +208,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer exponentiation"))
-    return W_IntObject(space, ix)
+    return wrapint(ix)
 
 def pow__Int_Int_Int(space, w_int1, w_int2, w_int3):
     x = w_int1.intval
@@ -247,7 +231,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer negation"))
-    return W_IntObject(space, x)
+    return wrapint(x)
 
 # pos__Int is supposed to do nothing, unless it has
 # a derived integer object, where it should return
@@ -267,7 +251,7 @@
 def invert__Int(space, w_int1):
     x = w_int1.intval
     a = ~x
-    return W_IntObject(space, a)
+    return wrapint(a)
 
 def lshift__Int_Int(space, w_int1, w_int2):
     a = w_int1.intval
@@ -297,7 +281,7 @@
     except OverflowError:
         raise FailedToImplement(space.w_OverflowError,
                                 space.wrap("integer left shift"))
-    return W_IntObject(space, c)
+    return wrapint(c)
 
 def rshift__Int_Int(space, w_int1, w_int2):
     a = w_int1.intval
@@ -316,25 +300,25 @@
         ## please look into pyport.h, how >> should be implemented!
         ## a = Py_ARITHMETIC_RIGHT_SHIFT(long, a, b);
         a = a >> b
-    return W_IntObject(space, a)
+    return wrapint(a)
 
 def and__Int_Int(space, w_int1, w_int2):
     a = w_int1.intval
     b = w_int2.intval
     res = a & b
-    return W_IntObject(space, res)
+    return wrapint(res)
 
 def xor__Int_Int(space, w_int1, w_int2):
     a = w_int1.intval
     b = w_int2.intval
     res = a ^ b
-    return W_IntObject(space, res)
+    return wrapint(res)
 
 def or__Int_Int(space, w_int1, w_int2):
     a = w_int1.intval
     b = w_int2.intval
     res = a | b
-    return W_IntObject(space, res)
+    return wrapint(res)
 
 # coerce is not wanted
 ##
@@ -356,7 +340,7 @@
     if space.is_w(space.type(w_int1), space.w_int):
         return w_int1
     a = w_int1.intval
-    return W_IntObject(space, a)
+    return wrapint(a)
 
 """
 # Not registered
@@ -378,7 +362,7 @@
     return space.wrap(hex(w_int1.intval))
 
 def getnewargs__Int(space, w_int1):
-    return space.newtuple([W_IntObject(space, w_int1.intval)])
+    return space.newtuple([wrapint(w_int1.intval)])
 
 
 register_all(vars())

Modified: pypy/dist/pypy/objspace/std/inttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/inttype.py	(original)
+++ pypy/dist/pypy/objspace/std/inttype.py	Sat May  6 00:05:47 2006
@@ -3,6 +3,10 @@
 from pypy.interpreter.error import OperationError
 from pypy.interpreter.gateway import NoneNotWrapped
 
+def wrapint(x):
+    from pypy.objspace.std.intobject import W_IntObject
+    return W_IntObject(x)
+
 def retry_to_w_long(space, parser, base=0):
     parser.rewind()
     try:
@@ -83,7 +87,7 @@
         return w_longval
     else:
         w_obj = space.allocate_instance(W_IntObject, w_inttype)
-        W_IntObject.__init__(w_obj, space, value)
+        W_IntObject.__init__(w_obj, value)
         return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/iterobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/iterobject.py	(original)
+++ pypy/dist/pypy/objspace/std/iterobject.py	Sat May  6 00:05:47 2006
@@ -10,8 +10,7 @@
 class W_SeqIterObject(W_Object):
     from pypy.objspace.std.itertype import iter_typedef as typedef
     
-    def __init__(w_self, space, w_seq, index=0):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, w_seq, index=0):
         w_self.w_seq = w_seq
         w_self.index = index
 
@@ -19,7 +18,6 @@
     from pypy.objspace.std.itertype import reverse_iter_typedef as typedef
     
     def __init__(w_self, space, w_seq, index=-1):
-        W_Object.__init__(w_self, space)
         w_self.w_seq = w_seq
         w_self.w_len = space.len(w_seq)
         w_self.index = space.int_w(w_self.w_len) + index

Modified: pypy/dist/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listobject.py	(original)
+++ pypy/dist/pypy/objspace/std/listobject.py	Sat May  6 00:05:47 2006
@@ -1,5 +1,5 @@
 from pypy.objspace.std.objspace import *
-from pypy.objspace.std.intobject import W_IntObject
+from pypy.objspace.std.inttype import wrapint
 from pypy.objspace.std.sliceobject import W_SliceObject
 from pypy.objspace.std.tupleobject import W_TupleObject
 
@@ -11,16 +11,14 @@
 class W_ListObject(W_Object):
     from pypy.objspace.std.listtype import list_typedef as typedef
     
-    def __init__(w_self, space, wrappeditems):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, wrappeditems):
         w_self.wrappeditems = wrappeditems
 
     def __repr__(w_self):
         """ representation for debugging purposes """
         return "%s(%s)" % (w_self.__class__.__name__, w_self.wrappeditems)
 
-    def unwrap(w_list):
-        space = w_list.space
+    def unwrap(w_list, space):
         items = [space.unwrap(w_item) for w_item in w_list.wrappeditems]# XXX generic mixed types unwrap
         return list(items)
 
@@ -28,15 +26,17 @@
 registerimplementation(W_ListObject)
 
 
+EMPTY_LIST = W_ListObject([])
+
 def init__List(space, w_list, __args__):
     w_iterable, = __args__.parse('list',
                                (['sequence'], None, None),   # signature
-                               [W_ListObject(space, [])])    # default argument
+                               [EMPTY_LIST])                 # default argument
     w_list.wrappeditems = space.unpackiterable(w_iterable)
 
 def len__List(space, w_list):
     result = len(w_list.wrappeditems)
-    return W_IntObject(space, result)
+    return wrapint(result)
 
 def getitem__List_ANY(space, w_list, w_index):
     idx = space.int_w(w_index)
@@ -49,11 +49,11 @@
 def getitem__List_Slice(space, w_list, w_slice):
     # XXX consider to extend rlist's functionality?
     length = len(w_list.wrappeditems)
-    start, stop, step, slicelength = w_slice.indices4(length)
+    start, stop, step, slicelength = w_slice.indices4(space, length)
     assert slicelength >= 0
     if step == 1 and 0 <= start <= stop:
-        return W_ListObject(space, w_list.wrappeditems[start:stop])
-    w_res = W_ListObject(space, [None] * slicelength)
+        return W_ListObject(w_list.wrappeditems[start:stop])
+    w_res = W_ListObject([None] * slicelength)
     items_w = w_list.wrappeditems
     subitems_w = w_res.wrappeditems
     for i in range(slicelength):
@@ -73,10 +73,10 @@
 
 def iter__List(space, w_list):
     from pypy.objspace.std import iterobject
-    return iterobject.W_SeqIterObject(space, w_list)
+    return iterobject.W_SeqIterObject(w_list)
 
 def add__List_List(space, w_list1, w_list2):
-    return W_ListObject(space, w_list1.wrappeditems + w_list2.wrappeditems)
+    return W_ListObject(w_list1.wrappeditems + w_list2.wrappeditems)
 
 def inplace_add__List_ANY(space, w_list1, w_iterable2):
     list_extend__List_ANY(space, w_list1, w_iterable2)
@@ -89,7 +89,7 @@
         if e.match(space, space.w_TypeError):
             raise FailedToImplement
         raise
-    return W_ListObject(space, w_list.wrappeditems * times)
+    return W_ListObject(w_list.wrappeditems * times)
 
 def mul__List_ANY(space, w_list, w_times):
     return mul_list_times(space, w_list, w_times)
@@ -164,7 +164,8 @@
     return space.w_None
 
 def delitem__List_Slice(space, w_list, w_slice):
-    start, stop, step, slicelength = w_slice.indices4(len(w_list.wrappeditems))
+    start, stop, step, slicelength = w_slice.indices4(space,
+                                                      len(w_list.wrappeditems))
 
     if slicelength==0:
         return
@@ -232,7 +233,7 @@
 
 def _setitem_slice_helper(space, w_list, w_slice, sequence2, len2):
     oldsize = len(w_list.wrappeditems)
-    start, stop, step, slicelength = w_slice.indices4(oldsize)
+    start, stop, step, slicelength = w_slice.indices4(space, oldsize)
     assert slicelength >= 0
     items = w_list.wrappeditems
 

Modified: pypy/dist/pypy/objspace/std/listtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/listtype.py	(original)
+++ pypy/dist/pypy/objspace/std/listtype.py	Sat May  6 00:05:47 2006
@@ -26,7 +26,7 @@
 ##''', filename=__file__).interphook('reversed')
 def list_reversed__ANY(space, w_list):
     from pypy.objspace.std.iterobject import W_ReverseSeqIterObject
-    return W_ReverseSeqIterObject(space,w_list,-1)
+    return W_ReverseSeqIterObject(space, w_list, -1)
 
 register_all(vars(), globals())
 
@@ -35,7 +35,7 @@
 def descr__new__(space, w_listtype, __args__):
     from pypy.objspace.std.listobject import W_ListObject
     w_obj = space.allocate_instance(W_ListObject, w_listtype)
-    W_ListObject.__init__(w_obj, space, [])
+    W_ListObject.__init__(w_obj, [])
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/longobject.py	Sat May  6 00:05:47 2006
@@ -86,15 +86,13 @@
     # Actually, all methods to be officially used are native implementations.
     from pypy.objspace.std.longtype import long_typedef as typedef
     
-    def __init__(w_self, space, digits, sign=0):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, digits, sign=0):
         #if isinstance(digits, long):  #YYYYYY
         #    digits, sign = args_from_long(digits)
         if len(digits) == 0:
             digits = [0]
         w_self.digits = DigitArray(digits)
         w_self.sign = sign
-        w_self.space = space
 
     def fromint(space, intval):
         if intval < 0:
@@ -104,7 +102,7 @@
             sign = 1
             ival = r_uint(intval)
         else:
-            return W_LongObject(space, [0], 0)
+            return W_LongObject([0], 0)
         # Count the number of Python digits.
         # We used to pick 5 ("big enough for anything"), but that's a
         # waste of time and space given that 5*15 = 75 bits are rarely
@@ -114,7 +112,7 @@
         while t:
             ndigits += 1
             t >>= SHIFT
-        v = W_LongObject(space, [0] * ndigits, sign)
+        v = W_LongObject([0] * ndigits, sign)
         t = ival
         p = 0
         while t:
@@ -133,7 +131,7 @@
             l += long(d)
         return l * self.sign
 
-    def unwrap(w_self): #YYYYYY
+    def unwrap(w_self, space): #YYYYYY
         return w_self.longval()
 
     def _normalize(self):
@@ -168,13 +166,12 @@
 FIVEARY_CUTOFF = 8
 
 # bool-to-long
-def delegate_Bool2Long(w_bool):
-    return W_LongObject(w_bool.space, [w_bool.boolval & MASK],
-                        int(w_bool.boolval))
+def delegate_Bool2Long(space, w_bool):
+    return W_LongObject([w_bool.boolval & MASK], int(w_bool.boolval))
 
 # int-to-long delegation
-def delegate_Int2Long(w_intobj):
-    return long__Int(w_intobj.space, w_intobj)
+def delegate_Int2Long(space, w_intobj):
+    return long__Int(space, w_intobj)
 
 
 # long__Long is supposed to do nothing, unless it has
@@ -185,7 +182,7 @@
         return w_long1
     digits = w_long1.digits
     sign = w_long1.sign
-    return W_LongObject(space, digits, sign)
+    return W_LongObject(digits, sign)
 
 def long__Int(space, w_intobj):
     return W_LongObject.fromint(space, w_intobj.intval)
@@ -328,22 +325,22 @@
     return result
 
 def truediv__Long_Long(space, w_long1, w_long2):
-    div = _long_true_divide(w_long1, w_long2)
+    div = _long_true_divide(space, w_long1, w_long2)
     return space.newfloat(div)
 
 def floordiv__Long_Long(space, w_long1, w_long2):
-    div, mod = _l_divmod(w_long1, w_long2)
+    div, mod = _l_divmod(space, w_long1, w_long2)
     return div
 
 def div__Long_Long(space, w_long1, w_long2):
     return floordiv__Long_Long(space, w_long1, w_long2)
 
 def mod__Long_Long(space, w_long1, w_long2):
-    div, mod = _l_divmod(w_long1, w_long2)
+    div, mod = _l_divmod(space, w_long1, w_long2)
     return mod
 
 def divmod__Long_Long(space, w_long1, w_long2):
-    div, mod = _l_divmod(w_long1, w_long2)
+    div, mod = _l_divmod(space, w_long1, w_long2)
     return space.newtuple([div, mod])
 
 def _impl_long_long_pow(space, a, b, c=None):
@@ -375,24 +372,24 @@
         #     modulus = -modulus
         if c.sign < 0:
             negativeOutput = True
-            c = W_LongObject(space, c.digits, -c.sign)
+            c = W_LongObject(c.digits, -c.sign)
 
         # if modulus == 1:
         #     return 0
         if len(c.digits) == 1 and c.digits[0] == 1:
-            return W_LongObject(space, [0], 0)
+            return W_LongObject([0], 0)
 
         # if base < 0:
         #     base = base % modulus
         # Having the base positive just makes things easier.
         if a.sign < 0:
-            a, temp = _l_divmod(a, c)
+            a, temp = _l_divmod(space, a, c)
             a = temp
 
     # At this point a, b, and c are guaranteed non-negative UNLESS
     # c is NULL, in which case a may be negative. */
 
-    z = W_LongObject(space, [1], 1)
+    z = W_LongObject([1], 1)
 
     # python adaptation: moved macros REDUCE(X) and MULT(X, Y, result)
     # into helper function result = _help_mult(x, y, c)
@@ -404,9 +401,9 @@
             bi = b.digits[i]
             j = 1 << (SHIFT-1)
             while j != 0:
-                z = _help_mult(z, z, c)
+                z = _help_mult(space, z, z, c)
                 if bi & j:
-                    z = _help_mult(z, a, c)
+                    z = _help_mult(space, z, a, c)
                 j >>= 1
             i -= 1
     else:
@@ -415,7 +412,7 @@
         table = [z] * 32
         table[0] = z;
         for i in range(1, 32):
-            table[i] = _help_mult(table[i-1], a, c)
+            table[i] = _help_mult(space, table[i-1], a, c)
         i = len(b.digits) - 1
         while i >= 0:
             bi = b.digits[i]
@@ -423,26 +420,26 @@
             while j >= 0:
                 index = (bi >> j) & 0x1f
                 for k in range(5):
-                    z = _help_mult(z, z, c)
+                    z = _help_mult(space, z, z, c)
                 if index:
-                    z = _help_mult(z, table[index], c)
+                    z = _help_mult(space, z, table[index], c)
                 j -= 5
             i -= 1
 
     if negativeOutput and z.sign != 0:
-        z = sub__Long_Long(z.space, z, c)
+        z = sub__Long_Long(space, z, c)
     return z
 
-def _help_mult(x, y, c):
+def _help_mult(space, x, y, c):
     """
     Multiply two values, then reduce the result:
     result = X*Y % c.  If c is NULL, skip the mod.
     """
-    res = mul__Long_Long(x.space, x, y)
+    res = mul__Long_Long(space, x, y)
     # Perform a modular reduction, X = X % c, but leave X alone if c
     # is NULL.
     if c is not None:
-        res, temp = _l_divmod(res, c)
+        res, temp = _l_divmod(space, res, c)
         res = temp
     return res
 
@@ -454,19 +451,19 @@
 
 
 def neg__Long(space, w_long1):
-    return W_LongObject(space, w_long1.digits, -w_long1.sign)
+    return W_LongObject(w_long1.digits, -w_long1.sign)
 
 def pos__Long(space, w_long):
     return long__Long(space, w_long)
 
 def abs__Long(space, w_long):
-    return W_LongObject(space, w_long.digits, abs(w_long.sign))
+    return W_LongObject(w_long.digits, abs(w_long.sign))
 
 def nonzero__Long(space, w_long):
     return space.newbool(w_long.sign != 0)
 
 def invert__Long(space, w_long): #Implement ~x as -(x + 1)
-    w_lpp = add__Long_Long(space, w_long, W_LongObject(space, [1], 1))
+    w_lpp = add__Long_Long(space, w_long, W_LongObject([1], 1))
     return neg__Long(space, w_lpp)
 
 def lshift__Long_Long(space, w_long1, w_long2):
@@ -490,7 +487,7 @@
     newsize = oldsize + wordshift
     if remshift:
         newsize += 1
-    z = W_LongObject(space, [0] * newsize, a.sign)
+    z = W_LongObject([0] * newsize, a.sign)
     # not sure if we will initialize things in the future?
     for i in range(wordshift):
         z.digits[i] = 0
@@ -530,13 +527,13 @@
     wordshift = shiftby // SHIFT
     newsize = len(a.digits) - wordshift
     if newsize <= 0:
-        return W_LongObject(space, [0], 0)
+        return W_LongObject([0], 0)
 
     loshift = shiftby % SHIFT
     hishift = SHIFT - loshift
     lomask = (1 << hishift) - 1
     himask = MASK ^ lomask
-    z = W_LongObject(space, [0] * newsize, a.sign)
+    z = W_LongObject([0] * newsize, a.sign)
     i = 0
     j = wordshift
     while i < newsize:
@@ -549,13 +546,13 @@
     return z
 
 def and__Long_Long(space, w_long1, w_long2):
-    return _bitwise(w_long1, '&', w_long2)
+    return _bitwise(space, w_long1, '&', w_long2)
 
 def xor__Long_Long(space, w_long1, w_long2):
-    return _bitwise(w_long1, '^', w_long2)
+    return _bitwise(space, w_long1, '^', w_long2)
 
 def or__Long_Long(space, w_long1, w_long2):
-    return _bitwise(w_long1, '|', w_long2)
+    return _bitwise(space, w_long1, '|', w_long2)
 
 def oct__Long(space, w_long1):
     return space.wrap(_format(w_long1, 8, True))
@@ -564,7 +561,7 @@
     return space.wrap(_format(w_long1, 16, True))
 
 def getnewargs__Long(space, w_long1):
-    return space.newtuple([W_LongObject(space, w_long1.digits, w_long1.sign)])
+    return space.newtuple([W_LongObject(w_long1.digits, w_long1.sign)])
 
 def log__Long(space, w_long, base):
     # base is supposed to be positive or 0.0, which means we use e
@@ -584,8 +581,8 @@
 for opname in ['add', 'sub', 'mul', 'div', 'floordiv', 'truediv', 'mod', 'divmod', 'lshift']:
     exec compile("""
 def %(opname)s_ovr__Int_Int(space, w_int1, w_int2):
-    w_long1 = delegate_Int2Long(w_int1)
-    w_long2 = delegate_Int2Long(w_int2)
+    w_long1 = delegate_Int2Long(space, w_int1)
+    w_long2 = delegate_Int2Long(space, w_int2)
     return %(opname)s__Long_Long(space, w_long1, w_long2)
 """ % {'opname': opname}, '', 'exec')
 
@@ -595,7 +592,7 @@
 for opname in ['neg', 'abs']:
     exec """
 def %(opname)s_ovr__Int(space, w_int1):
-    w_long1 = delegate_Int2Long(w_int1)
+    w_long1 = delegate_Int2Long(space, w_int1)
     return %(opname)s__Long(space, w_long1)
 """ % {'opname': opname}
 
@@ -603,13 +600,13 @@
 
 # pow
 def pow_ovr__Int_Int_None(space, w_int1, w_int2, w_none3):
-    w_long1 = delegate_Int2Long(w_int1)
-    w_long2 = delegate_Int2Long(w_int2)
+    w_long1 = delegate_Int2Long(space, w_int1)
+    w_long2 = delegate_Int2Long(space, w_int2)
     return pow__Long_Long_None(space, w_long1, w_long2, w_none3)
 
 def pow_ovr__Int_Int_Long(space, w_int1, w_int2, w_long3):
-    w_long1 = delegate_Int2Long(w_int1)
-    w_long2 = delegate_Int2Long(w_int2)
+    w_long1 = delegate_Int2Long(space, w_int1)
+    w_long2 = delegate_Int2Long(space, w_int2)
     return pow__Long_Long_Long(space, w_long1, w_long2, w_long3)
 
 StdObjSpace.MM.pow.register(pow_ovr__Int_Int_None, W_IntObject, W_IntObject, W_NoneObject, order=1)
@@ -647,7 +644,7 @@
     if size_a < size_b:
         a, b = b, a
         size_a, size_b = size_b, size_a
-    z = W_LongObject(a.space, [0] * (len(a.digits) + 1), 1)
+    z = W_LongObject([0] * (len(a.digits) + 1), 1)
     i = 0
     carry = 0
     while i < size_b:
@@ -682,12 +679,12 @@
         while i >= 0 and a.digits[i] == b.digits[i]:
             i -= 1
         if i < 0:
-            return W_LongObject(a.space, [0], 0)
+            return W_LongObject([0], 0)
         if a.digits[i] < b.digits[i]:
             sign = -1
             a, b = b, a
         size_a = size_b = i+1
-    z = W_LongObject(a.space, [0] * size_a, 1)
+    z = W_LongObject([0] * size_a, 1)
     i = 0
     while i < size_b:
         # The following assumes unsigned arithmetic
@@ -718,7 +715,7 @@
 
     size_a = len(a.digits)
     size_b = len(b.digits)
-    z = W_LongObject(a.space, [0] * (size_a + size_b), 1)
+    z = W_LongObject([0] * (size_a + size_b), 1)
     if a == b:
         # Efficient squaring per HAC, Algorithm 14.16:
         # http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
@@ -792,8 +789,8 @@
     size_n = len(n.digits)
     size_lo = min(size_n, size)
 
-    lo = W_LongObject(n.space, n.digits[:size_lo], 1)
-    hi = W_LongObject(n.space, n.digits[size_lo:], 1)
+    lo = W_LongObject(n.digits[:size_lo], 1)
+    hi = W_LongObject(n.digits[size_lo:], 1)
     lo._normalize()
     hi._normalize()
     return hi, lo
@@ -825,7 +822,7 @@
         i = KARATSUBA_CUTOFF
     if asize <= i:
         if a.sign == 0:
-            return W_LongObject(a.space, [0], 0)
+            return W_LongObject([0], 0)
         else:
             return _x_mul(a, b)
 
@@ -864,7 +861,7 @@
     #    at shift.
 
     # 1. Allocate result space.
-    ret = W_LongObject(a.space, [0] * (asize + bsize), 1)
+    ret = W_LongObject([0] * (asize + bsize), 1)
 
     # 2. t1 <- ah*bh, and copy into high digits of result.
     t1 = _k_mul(ah, bh)
@@ -983,12 +980,12 @@
     assert 2 * asize <= bsize
 
     # Allocate result space, and zero it out.
-    ret = W_LongObject(a.space, [0] * (asize + bsize), 1)
+    ret = W_LongObject([0] * (asize + bsize), 1)
 
     # Successive slices of b are copied into bslice.
-    #bslice = W_LongObject(a.space, [0] * asize, 1)
+    #bslice = W_LongObject([0] * asize, 1)
     # XXX we cannot pre-allocate, see comments below!
-    bslice = W_LongObject(a.space, [0], 1)
+    bslice = W_LongObject([0], 1)
 
     nbdone = 0;
     while bsize > 0:
@@ -1041,7 +1038,7 @@
     """
     assert n > 0 and n <= MASK
     size = len(a.digits)
-    z = W_LongObject(a.space, [0] * size, 1)
+    z = W_LongObject([0] * size, 1)
     rem = _inplace_divrem1(z, a, n)
     z._normalize()
     return z, rem
@@ -1105,7 +1102,7 @@
     """Multiply by a single digit and add a single digit, ignoring the sign.
     """
     size_a = len(a.digits)
-    z = W_LongObject(a.space, [0] * (size_a+1), 1)
+    z = W_LongObject([0] * (size_a+1), 1)
     carry = extra
     assert carry & MASK == carry
     i = 0
@@ -1130,7 +1127,7 @@
     assert size_v >= size_w and size_w > 1 # Assert checks by div()
 
     size_a = size_v - size_w + 1
-    a = W_LongObject(v.space, [0] * size_a, 1)
+    a = W_LongObject([0] * size_a, 1)
 
     j = size_v
     k = size_a - 1
@@ -1192,25 +1189,25 @@
     return a, rem
 
 
-def _divrem(a, b):
+def _divrem(space, a, b):
     """ Long division with remainder, top-level routine """
     size_a = len(a.digits)
     size_b = len(b.digits)
 
     if b.sign == 0:
-        raise OperationError(a.space.w_ZeroDivisionError,
-                             a.space.wrap("long division or modulo by zero"))
+        raise OperationError(space.w_ZeroDivisionError,
+                             space.wrap("long division or modulo by zero"))
 
     if (size_a < size_b or
         (size_a == size_b and
          a.digits[size_a-1] < b.digits[size_b-1])):
         # |a| < |b|
-        z = W_LongObject(a.space, [0], 0)
+        z = W_LongObject([0], 0)
         rem = a
         return z, rem
     if size_b == 1:
         z, urem = _divrem1(a, b.digits[0])
-        rem = W_LongObject(a.space, [urem], int(urem != 0))
+        rem = W_LongObject([urem], int(urem != 0))
     else:
         z, rem = _x_divrem(a, b)
     # Set the signs.
@@ -1304,13 +1301,13 @@
     return func(x) + (e * float(SHIFT) * func(2.0))
 _loghelper._annspecialcase_ = 'specialize:arg(0)'
 
-def _long_true_divide(a, b):
+def _long_true_divide(space, a, b):
     try:
         ad, aexp = _AsScaledDouble(a)
         bd, bexp = _AsScaledDouble(b)
         if bd == 0.0:
-            raise OperationError(a.space.w_ZeroDivisionError,
-                                 a.space.wrap("long division or modulo by zero"))
+            raise OperationError(space.w_ZeroDivisionError,
+                                 space.wrap("long division or modulo by zero"))
 
         # True value is very close to ad/bd * 2**(SHIFT*(aexp-bexp))
         ad /= bd   # overflow/underflow impossible here
@@ -1325,8 +1322,8 @@
         # math.ldexp checks and raises
         return ad
     except OverflowError:
-        raise OperationError(a.space.w_OverflowError,
-                             a.space.wrap("long/long too large for a float"))
+        raise OperationError(space.w_OverflowError,
+                             space.wrap("long/long too large for a float"))
 
 
 def _FromDouble(space, dval):
@@ -1339,9 +1336,9 @@
         dval = -dval
     frac, expo = math.frexp(dval) # dval = frac*2**expo; 0.0 <= frac < 1.0
     if expo <= 0:
-        return W_LongObject(space, [0], 0)
+        return W_LongObject([0], 0)
     ndig = (expo-1) // SHIFT + 1 # Number of 'digits' in result
-    v = W_LongObject(space, [0] * ndig, 1)
+    v = W_LongObject([0] * ndig, 1)
     frac = math.ldexp(frac, (expo-1) % SHIFT + 1)
     for i in range(ndig-1, -1, -1):
         bits = int(frac) & MASK # help the future annotator?
@@ -1352,7 +1349,7 @@
         v.sign = -1
     return v
 
-def _l_divmod(v, w):
+def _l_divmod(space, v, w):
     """
     The / and % operators are now defined in terms of divmod().
     The expression a mod b has the value a - b*floor(a/b).
@@ -1369,11 +1366,11 @@
     have different signs.  We then subtract one from the 'div'
     part of the outcome to keep the invariant intact.
     """
-    div, mod = _divrem(v, w)
+    div, mod = _divrem(space, v, w)
     if mod.sign * w.sign == -1:
-        mod = add__Long_Long(v.space, mod, w)
-        one = W_LongObject(v.space, [1], 1)
-        div = sub__Long_Long(v.space, div, one)
+        mod = add__Long_Long(space, mod, w)
+        one = W_LongObject([1], 1)
+        div = sub__Long_Long(space, div, one)
     return div, mod
 
 
@@ -1457,7 +1454,7 @@
             power += 1
 
         # Get a scratch area for repeated division.
-        scratch = W_LongObject(a.space, [0] * size, 1)
+        scratch = W_LongObject([0] * size, 1)
 
         # Repeatedly divide by powbase.
         while 1:
@@ -1518,16 +1515,16 @@
         return ''.join(s[p:])
 
 
-def _bitwise(a, op, b): # '&', '|', '^'
+def _bitwise(space, a, op, b): # '&', '|', '^'
     """ Bitwise and/or/xor operations """
 
     if a.sign < 0:
-        a = invert__Long(a.space, a)
+        a = invert__Long(space, a)
         maska = MASK
     else:
         maska = 0
     if b.sign < 0:
-        b = invert__Long(b.space, b)
+        b = invert__Long(space, b)
         maskb = MASK
     else:
         maskb = 0
@@ -1572,7 +1569,7 @@
     else:
         size_z = max(size_a, size_b)
 
-    z = W_LongObject(a.space, [0] * size_z, 1)
+    z = W_LongObject([0] * size_z, 1)
 
     for i in range(size_z):
         if i < size_a:
@@ -1593,7 +1590,7 @@
     z._normalize()
     if negz == 0:
         return z
-    return invert__Long(z.space, z)
+    return invert__Long(space, z)
 
 def _AsLong(v):
     """

Modified: pypy/dist/pypy/objspace/std/longtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/longtype.py	(original)
+++ pypy/dist/pypy/objspace/std/longtype.py	Sat May  6 00:05:47 2006
@@ -42,7 +42,7 @@
                     sign = 1
                 else:
                     sign = 0
-                w_value = W_LongObject(space, [abs(intval)], sign) 
+                w_value = W_LongObject([abs(intval)], sign) 
             else:
                 raise OperationError(space.w_ValueError,
                                     space.wrap("value can't be converted to long"))
@@ -66,7 +66,7 @@
                                  space.wrap(e.msg))
 
     w_obj = space.allocate_instance(W_LongObject, w_longtype)
-    W_LongObject.__init__(w_obj, space, w_value.digits, w_value.sign)
+    W_LongObject.__init__(w_obj, w_value.digits, w_value.sign)
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/marshal_impl.py
==============================================================================
--- pypy/dist/pypy/objspace/std/marshal_impl.py	(original)
+++ pypy/dist/pypy/objspace/std/marshal_impl.py	Sat May  6 00:05:47 2006
@@ -11,6 +11,7 @@
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std.register_all import register_all
 from pypy.rpython.rarithmetic import LONG_BIT
+from pypy.objspace.std.inttype import wrapint
 from pypy.objspace.std.floatobject import repr__Float as repr_float
 from pypy.objspace.std.longobject import SHIFT as long_bits
 from pypy.objspace.std.objspace import StdObjSpace
@@ -141,14 +142,14 @@
             m.atom_int(TYPE_INT, w_int.intval)
 
 def unmarshal_Int(space, u, tc):
-    return W_IntObject(space, u.get_int())
+    return wrapint(u.get_int())
 register(TYPE_INT, unmarshal_Int)
 
 def unmarshal_Int64(space, u, tc):
     if LONG_BIT >= 64:
         lo = u.get_int() & (2**32-1)
         hi = u.get_int()
-        return W_IntObject(space, (hi << 32) | lo)
+        return wrapint((hi << 32) | lo)
     else:
         # fall back to a long
         # XXX at some point, we need to extend longobject
@@ -198,7 +199,7 @@
 def unmarshal_Float(space, u, tc):
     if tc == TYPE_BINARY_FLOAT:
         w_ret = str_to_float(space, space.wrap(u.get(8)))
-        return W_FloatObject(space, space.float_w(w_ret))
+        return W_FloatObject(space.float_w(w_ret))
     else:
         return space.call_function(space.builtin.get('float'),
                                  space.wrap(u.get_pascal()))
@@ -266,7 +267,7 @@
             raise_exception(space, 'bad marshal data')
         digits[i] = digit
         i += 1
-    w_long = W_LongObject(space, digits, sign)
+    w_long = W_LongObject(digits, sign)
     w_long._normalize()
     return w_long
 register(TYPE_LONG, unmarshal_Long)
@@ -283,7 +284,7 @@
     # using the fastest possible access method here
     # that does not touch the internal representation,
     # which might change (array of bytes?)
-    s = w_str.unwrap()
+    s = w_str.unwrap(space)
     if m.version >= 1 and PySTRING_CHECK_INTERNED(w_str):
         # we use a native rtyper stringdict for speed
         idx = m.stringtable.get(s, -1)
@@ -297,11 +298,11 @@
         m.atom_str(TYPE_STRING, s)
 
 def unmarshal_String(space, u, tc):
-    return W_StringObject(space, u.get_str())
+    return W_StringObject(u.get_str())
 register(TYPE_STRING, unmarshal_String)
 
 def unmarshal_interned(space, u, tc):
-    w_ret = W_StringObject(space, u.get_str())
+    w_ret = W_StringObject(u.get_str())
     u.stringtable_w.append(w_ret)
     w_intern = space.builtin.get('intern')
     space.call_function(w_intern, w_ret)
@@ -323,7 +324,7 @@
 
 def unmarshal_Tuple(space, u, tc):
     items_w = u.get_list_w()
-    return W_TupleObject(space, items_w)
+    return W_TupleObject(items_w)
 register(TYPE_TUPLE, unmarshal_Tuple)
 
 def marshal_w__List(space, w_list, m):
@@ -333,10 +334,10 @@
 
 def unmarshal_List(space, u, tc):
     items_w = u.get_list_w()
-    return W_ListObject(space, items_w)
+    return W_ListObject(items_w)
 
 def finish_List(space, items_w, typecode):
-    return W_ListObject(space, items_w)
+    return W_ListObject(items_w)
 register(TYPE_LIST, unmarshal_List)
 
 def marshal_w__Dict(space, w_dict, m):
@@ -467,7 +468,7 @@
 string_to_buffer = app.interphook('string_to_buffer')
 
 def unmarshal_buffer(space, u, tc):
-    w_s = W_StringObject(space, u.get_str())
+    w_s = W_StringObject(u.get_str())
     return string_to_buffer(space, w_s)
 register(TYPE_UNKNOWN, unmarshal_buffer)
 
@@ -510,7 +511,7 @@
         w_frozen = space.w_False
     else:
         w_frozen = space.w_True
-    w_lis = W_ListObject(space, items_w)
+    w_lis = W_ListObject(items_w)
     return list_to_set(space, w_lis, w_frozen)
 register(TYPE_SET + TYPE_FROZENSET, unmarshal_set_frozenset)
 

Modified: pypy/dist/pypy/objspace/std/model.py
==============================================================================
--- pypy/dist/pypy/objspace/std/model.py	(original)
+++ pypy/dist/pypy/objspace/std/model.py	Sat May  6 00:05:47 2006
@@ -138,14 +138,10 @@
 
 W_ANY = W_Root
 
-class W_Object(W_Root, object):
-    "Parent base class for wrapped objects."
-
-    def __init__(w_self, space):
-        w_self.space = space    # XXX not sure this is ever used any more
-        # Note that it is wrong to depend on a .space attribute for a random
-        # wrapped object anyway, because not all wrapped objects inherit from
-        # W_Object.  (They inherit from W_Root.)
+class W_Object(W_Root):
+    "Parent base class for wrapped objects provided by the StdObjSpace."
+    # Note that not all wrapped objects in the interpreter inherit from
+    # W_Object.  (They inherit from W_Root.)
 
     def __repr__(self):
         s = '%s(%s)' % (
@@ -158,7 +154,7 @@
             s += ' instance of %s' % self.w__class__
         return '<%s>' % s
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         raise UnwrapError, 'cannot unwrap %r' % (w_self,)
 
 class UnwrapError(Exception):

Modified: pypy/dist/pypy/objspace/std/multimethod.py
==============================================================================
--- pypy/dist/pypy/objspace/std/multimethod.py	(original)
+++ pypy/dist/pypy/objspace/std/multimethod.py	Sat May  6 00:05:47 2006
@@ -214,8 +214,10 @@
             callargs = funcargs[:]
             if conversion is not None:
                 to_convert = func_selfarg_index
+                convert_callargs = (self.multimethod.argnames_before +
+                                    [callargs[to_convert]])
                 callargs[to_convert] = '%s(%s)' % (
-                    invent_name(conversion), callargs[to_convert])
+                    invent_name(conversion), ', '.join(convert_callargs))
             callname = invent_name(call)
             if call_selfarg_index is not None:
                 # fallback on root_class

Modified: pypy/dist/pypy/objspace/std/noneobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/noneobject.py	(original)
+++ pypy/dist/pypy/objspace/std/noneobject.py	Sat May  6 00:05:47 2006
@@ -9,7 +9,7 @@
 class W_NoneObject(W_Object):
     from pypy.objspace.std.nonetype import none_typedef as typedef
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         return None
 
 registerimplementation(W_NoneObject)

Modified: pypy/dist/pypy/objspace/std/objecttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objecttype.py	(original)
+++ pypy/dist/pypy/objspace/std/objecttype.py	Sat May  6 00:05:47 2006
@@ -51,7 +51,7 @@
                                  space.wrap("default __new__ takes "
                                             "no parameters"))
     w_obj = space.allocate_instance(W_ObjectObject, w_type)
-    W_ObjectObject.__init__(w_obj, space)
+    #W_ObjectObject.__init__(w_obj)
     return w_obj
 
 def descr__init__(space, w_obj, __args__):

Modified: pypy/dist/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/std/objspace.py	(original)
+++ pypy/dist/pypy/objspace/std/objspace.py	Sat May  6 00:05:47 2006
@@ -79,11 +79,13 @@
         # hack to avoid imports in the time-critical functions below
         for cls in self.model.typeorder:
             globals()[cls.__name__] = cls
+        from pypy.objspace.std.inttype import wrapint
+        self.newint = wrapint
 
         # singletons
-        self.w_None  = W_NoneObject(self)
-        self.w_False = W_BoolObject(self, False)
-        self.w_True  = W_BoolObject(self, True)
+        self.w_None  = W_NoneObject()
+        self.w_False = W_BoolObject(False)
+        self.w_True  = W_BoolObject(True)
         from pypy.interpreter.special import NotImplemented, Ellipsis
         self.w_NotImplemented = self.wrap(NotImplemented(self))  
         self.w_Ellipsis = self.wrap(Ellipsis(self))  
@@ -259,53 +261,54 @@
             raise TypeError, ("attempt to wrap already wrapped exception: %s"%
                               (x,))
         if isinstance(x, int):
-            if isinstance(bool, type) and isinstance(x, bool):
+            if isinstance(x, bool):
                 return self.newbool(x)
-            return W_IntObject(self, x)
+            else:
+                return self.newint(x)
         if isinstance(x, str):
-            return W_StringObject(self, x)
+            return W_StringObject(x)
         if isinstance(x, unicode):
-            return W_UnicodeObject(self, [unichr(ord(u)) for u in x]) # xxx
+            return W_UnicodeObject([unichr(ord(u)) for u in x]) # xxx
         if isinstance(x, dict):
             items_w = [(self.wrap(k), self.wrap(v)) for (k, v) in x.iteritems()]
             return self.newdict(items_w)
         if isinstance(x, float):
-            return W_FloatObject(self, x)
+            return W_FloatObject(x)
         if isinstance(x, tuple):
             wrappeditems = [self.wrap(item) for item in list(x)]
-            return W_TupleObject(self, wrappeditems)
+            return W_TupleObject(wrappeditems)
         if isinstance(x, list):
             wrappeditems = [self.wrap(item) for item in x]
-            return W_ListObject(self, wrappeditems)
+            return W_ListObject(wrappeditems)
         if isinstance(x, Wrappable):
             w_result = x.__spacebind__(self)
             #print 'wrapping', x, '->', w_result
             return w_result
         if isinstance(x, base_int):
             from pypy.objspace.std.longobject import args_from_long
-            return W_LongObject(self, *args_from_long(x))
+            return W_LongObject(*args_from_long(x))
 
         # _____ below here is where the annotator should not get _____
         
         if isinstance(x, long):
             from pypy.objspace.std.longobject import args_from_long
-            return W_LongObject(self, *args_from_long(x))
+            return W_LongObject(*args_from_long(x))
         if isinstance(x, slice):
-            return W_SliceObject(self, self.wrap(x.start),
-                                       self.wrap(x.stop),
-                                       self.wrap(x.step))
+            return W_SliceObject(self.wrap(x.start),
+                                 self.wrap(x.stop),
+                                 self.wrap(x.step))
         if isinstance(x, complex):
-            return W_ComplexObject(self, x.real, x.imag)
+            return W_ComplexObject(x.real, x.imag)
 
         if isinstance(x, set):
             if WITHSET:
                 wrappeditems = [self.wrap(item) for item in x]
-                return W_SetObject(self, wrappeditems)
+                return W_SetObject(wrappeditems)
 
         if isinstance(x, frozenset):
             if WITHSET:
                 wrappeditems = [self.wrap(item) for item in x]
-                return W_FrozensetObject(self, wrappeditems)
+                return W_FrozensetObject(wrappeditems)
 
         if x is __builtin__.Ellipsis:
             # '__builtin__.Ellipsis' avoids confusion with special.Ellipsis
@@ -340,35 +343,35 @@
         if isinstance(w_obj, Wrappable):
             return w_obj
         if isinstance(w_obj, W_Object):
-            return w_obj.unwrap()
+            return w_obj.unwrap(self)
         raise UnwrapError, "cannot unwrap: %r" % w_obj
-        
 
-    def newint(self, intval):
-        return W_IntObject(self, intval)
+    #def newint(self, intval):
+    #    this time-critical and circular-imports-funny method is stored
+    #    on 'self' by initialize()
 
     def newfloat(self, floatval):
-        return W_FloatObject(self, floatval)
+        return W_FloatObject(floatval)
 
     def newcomplex(self, realval, imagval):
-        return W_ComplexObject(self, realval, imagval)
+        return W_ComplexObject(realval, imagval)
 
     if WITHSET:
         def newset(self, rdict_w):
-            return W_SetObject(self, rdict_w)
+            return W_SetObject(rdict_w)
 
         def newfrozenset(self, rdict_w):
-            return W_FrozensetObject(self, rdict_w)
+            return W_FrozensetObject(rdict_w)
 
     def newlong(self, val): # val is an int
         return W_LongObject.fromint(self, val)
 
     def newtuple(self, list_w):
         assert isinstance(list_w, list)
-        return W_TupleObject(self, list_w)
+        return W_TupleObject(list_w)
 
     def newlist(self, list_w):
-        return W_ListObject(self, list_w)
+        return W_ListObject(list_w)
 
     def newdict(self, list_pairs_w):
         w_result = W_DictObject(self)
@@ -376,7 +379,7 @@
         return w_result
 
     def newslice(self, w_start, w_end, w_step):
-        return W_SliceObject(self, w_start, w_end, w_step)
+        return W_SliceObject(w_start, w_end, w_step)
 
     def newstring(self, chars_w):
         try:
@@ -384,7 +387,7 @@
         except ValueError:  # chr(out-of-range)
             raise OperationError(self.w_ValueError,
                                  self.wrap("character code not in range(256)"))
-        return W_StringObject(self, ''.join(chars))
+        return W_StringObject(''.join(chars))
 
     def newunicode(self, chars):
         try:
@@ -392,10 +395,10 @@
         except ValueError, e:  # unichr(out-of-range)
             msg = "character code not in range(%s)" % hex(sys.maxunicode+1)
             raise OperationError(self.w_ValueError, self.wrap(msg))
-        return W_UnicodeObject(self, chars)
+        return W_UnicodeObject(chars)
 
     def newseqiter(self, w_obj):
-        return W_SeqIterObject(self, w_obj)
+        return W_SeqIterObject(w_obj)
 
     def type(self, w_obj):
         return w_obj.getclass(self)

Modified: pypy/dist/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/setobject.py	(original)
+++ pypy/dist/pypy/objspace/std/setobject.py	Sat May  6 00:05:47 2006
@@ -8,8 +8,7 @@
 
 class W_BaseSetObject(W_Object):
 
-    def __init__(w_self, space, setdata=None):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, setdata=None):
         if setdata is None:
             w_self.setdata = r_dict(space.eq_w, space.hash_w)
         else:
@@ -21,28 +20,25 @@
         return "<%s(%s)>" % (w_self.__class__.__name__, ', '.join(reprlist))
 
     def _newobj(w_self, space, rdict_w=None):
-        #return space.call(space.type(w_self),W_SetIterObject(space,rdict_w))
+        #return space.call(space.type(w_self),W_SetIterObject(rdict_w))
         objtype = type(w_self)
         if objtype is W_SetObject:
-            obj = W_SetObject(space, rdict_w)
+            obj = W_SetObject(rdict_w)
         elif objtype is W_FrozensetObject:
-            obj = W_FrozensetObject(space, rdict_w)
+            obj = W_FrozensetObject(rdict_w)
         else:
-            itemiterator = space.iter(W_SetIterObject(space,rdict_w))
+            itemiterator = space.iter(W_SetIterObject(rdict_w))
             obj = space.call_function(space.type(w_self),itemiterator)
         return obj
 
 class W_SetObject(W_BaseSetObject):
     from pypy.objspace.std.settype import set_typedef as typedef
 
-    def __init__(w_self, space, setdata=None):
-        W_BaseSetObject.__init__(w_self, space, setdata)
-
 class W_FrozensetObject(W_BaseSetObject):
     from pypy.objspace.std.frozensettype import frozenset_typedef as typedef
 
-    def __init__(w_self, space, setdata):
-        W_BaseSetObject.__init__(w_self, space, setdata)
+    def __init__(w_self, setdata):
+        W_BaseSetObject.__init__(w_self, setdata)
         w_self.hash = -1
 
 registerimplementation(W_SetObject)
@@ -51,8 +47,7 @@
 class W_SetIterObject(W_Object):
     from pypy.objspace.std.settype import setiter_typedef as typedef
 
-    def __init__(w_self, space, setdata):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, setdata):
         w_self.content = content = setdata
         w_self.len = len(content)
         w_self.pos = 0
@@ -525,7 +520,7 @@
 len__Frozenset = len__Set
 
 def iter__Set(space, w_left):
-    return W_SetIterObject(space, w_left.setdata)
+    return W_SetIterObject(w_left.setdata)
 
 iter__Frozenset = iter__Set
 

Modified: pypy/dist/pypy/objspace/std/settype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/settype.py	(original)
+++ pypy/dist/pypy/objspace/std/settype.py	Sat May  6 00:05:47 2006
@@ -29,7 +29,7 @@
 def descr__new__(space, w_settype, __args__):
     from pypy.objspace.std.setobject import W_SetObject
     w_obj = space.allocate_instance(W_SetObject, w_settype)
-    W_SetObject.__init__(w_obj, space, None)
+    W_SetObject.__init__(w_obj, None)
     return w_obj
 
 set_typedef = StdTypeDef("set",

Modified: pypy/dist/pypy/objspace/std/sliceobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/sliceobject.py	(original)
+++ pypy/dist/pypy/objspace/std/sliceobject.py	Sat May  6 00:05:47 2006
@@ -13,8 +13,7 @@
 class W_SliceObject(W_Object):
     from pypy.objspace.std.slicetype import slice_typedef as typedef
     
-    def __init__(w_self, space, w_start, w_stop, w_step):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, w_start, w_stop, w_step):
         assert w_start is not None
         assert w_stop is not None
         assert w_step is not None
@@ -22,12 +21,10 @@
         w_self.w_stop = w_stop
         w_self.w_step = w_step
 
-    def unwrap(w_slice):
-        space = w_slice.space
+    def unwrap(w_slice, space):
         return slice(space.unwrap(w_slice.w_start), space.unwrap(w_slice.w_stop), space.unwrap(w_slice.w_step))
 
-    def indices3(w_slice, length):
-        space = w_slice.space
+    def indices3(w_slice, space, length):
         if space.is_w(w_slice.w_step, space.w_None):
             step = 1
         else:
@@ -69,8 +66,8 @@
                 stop = length
         return start, stop, step
 
-    def indices4(w_slice, length):
-        start, stop, step = w_slice.indices3(length)
+    def indices4(w_slice, space, length):
+        start, stop, step = w_slice.indices3(space, length)
         if (step < 0 and stop >= start) or (step > 0 and start >= stop):
             slicelength = 0
         elif step < 0:
@@ -115,7 +112,7 @@
 
 def slice_indices__Slice_ANY(space, w_slice, w_length):
     length = space.int_w(w_length)
-    start, stop, step = w_slice.indices3(length)
+    start, stop, step = w_slice.indices3(space, length)
     return space.newtuple([space.wrap(start), space.wrap(stop),
                            space.wrap(step)])
 

Modified: pypy/dist/pypy/objspace/std/slicetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/slicetype.py	(original)
+++ pypy/dist/pypy/objspace/std/slicetype.py	Sat May  6 00:05:47 2006
@@ -56,7 +56,7 @@
         raise OperationError(space.w_TypeError,
                              space.wrap("slice() takes at least 1 argument"))
     w_obj = space.allocate_instance(W_SliceObject, w_slicetype)
-    W_SliceObject.__init__(w_obj, space, w_start, w_stop, w_step)
+    W_SliceObject.__init__(w_obj, w_start, w_stop, w_step)
     return w_obj
 #
 descr__new__.unwrap_spec = [baseobjspace.ObjSpace, baseobjspace.W_Root,

Modified: pypy/dist/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringobject.py	(original)
+++ pypy/dist/pypy/objspace/std/stringobject.py	Sat May  6 00:05:47 2006
@@ -4,7 +4,7 @@
 from pypy.interpreter import gateway
 from pypy.rpython.rarithmetic import ovfcheck, _hash_string
 from pypy.rpython.objectmodel import we_are_translated
-from pypy.objspace.std.intobject   import W_IntObject
+from pypy.objspace.std.inttype import wrapint
 from pypy.objspace.std.sliceobject import W_SliceObject
 from pypy.objspace.std import slicetype
 from pypy.objspace.std.listobject import W_ListObject
@@ -18,23 +18,21 @@
 class W_StringObject(W_Object):
     from pypy.objspace.std.stringtype import str_typedef as typedef
 
-    def __init__(w_self, space, str):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, str):
         w_self._value = str
 
     def __repr__(w_self):
         """ representation for debugging purposes """
         return "%s(%r)" % (w_self.__class__.__name__, w_self._value)
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         return w_self._value
 
 
 registerimplementation(W_StringObject)
 
 
-def _is_generic(w_self, fun): 
-    space = w_self.space   
+def _is_generic(space, w_self, fun): 
     v = w_self._value
     if len(v) == 0:
         return space.w_False
@@ -46,7 +44,7 @@
             if not fun(v[idx]):
                 return space.w_False
         return space.w_True
-_is_generic._annspecialcase_ = "specialize:arg(1)"
+_is_generic._annspecialcase_ = "specialize:arg(2)"
 
 def _upper(ch):
     if ch.islower():
@@ -68,21 +66,20 @@
 _isalnum = lambda c: c.isalnum()
 
 def str_isspace__String(space, w_self):
-    return _is_generic(w_self, _isspace)
+    return _is_generic(space, w_self, _isspace)
 
 def str_isdigit__String(space, w_self):
-    return _is_generic(w_self, _isdigit)
+    return _is_generic(space, w_self, _isdigit)
 
 def str_isalpha__String(space, w_self):
-    return _is_generic(w_self, _isalpha)
+    return _is_generic(space, w_self, _isalpha)
 
 def str_isalnum__String(space, w_self):
-    return _is_generic(w_self, _isalnum)
+    return _is_generic(space, w_self, _isalnum)
 
 def str_isupper__String(space, w_self):
     """Return True if all cased characters in S are uppercase and there is
 at least one cased character in S, False otherwise."""
-    space = w_self.space   
     v = w_self._value
     if len(v) == 1:
         c = v[0]
@@ -98,7 +95,6 @@
 def str_islower__String(space, w_self):
     """Return True if all cased characters in S are lowercase and there is
 at least one cased character in S, False otherwise."""
-    space = w_self.space   
     v = w_self._value
     if len(v) == 1:
         c = v[0]
@@ -233,12 +229,12 @@
             maxsplit -= 1   # NB. if it's already < 0, it stays < 0
 
         # the word is value[i:j]
-        res_w.append(W_StringObject(space, value[i:j]))
+        res_w.append(W_StringObject(value[i:j]))
 
         # continue to look from the character following the space after the word
         i = j + 1
 
-    return W_ListObject(space, res_w)
+    return W_ListObject(res_w)
 
 
 def str_split__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
@@ -255,13 +251,13 @@
         next = value.find(by, start)
         if next < 0:
             break
-        res_w.append(W_StringObject(space, value[start:next]))
+        res_w.append(W_StringObject(value[start:next]))
         start = next + bylen
         maxsplit -= 1   # NB. if it's already < 0, it stays < 0
 
-    res_w.append(W_StringObject(space, value[start:]))
+    res_w.append(W_StringObject(value[start:]))
 
-    return W_ListObject(w_self.space, res_w)
+    return W_ListObject(res_w)
 
 def str_rsplit__String_None_ANY(space, w_self, w_none, w_maxsplit=-1):
     maxsplit = space.int_w(w_maxsplit)
@@ -290,13 +286,13 @@
         # the word is value[j+1:i+1]
         j1 = j + 1
         assert j1 >= 0
-        res_w.append(W_StringObject(space, value[j1:i+1]))
+        res_w.append(W_StringObject(value[j1:i+1]))
 
         # continue to look from the character before the space before the word
         i = j - 1
 
     res_w.reverse()
-    return W_ListObject(space, res_w)
+    return W_ListObject(res_w)
 
 def str_rsplit__String_String_ANY(space, w_self, w_by, w_maxsplit=-1):
     maxsplit = space.int_w(w_maxsplit)
@@ -312,13 +308,13 @@
         next = value.rfind(by, 0, end)
         if next < 0:
             break
-        res_w.append(W_StringObject(space, value[next+bylen:end]))
+        res_w.append(W_StringObject(value[next+bylen:end]))
         end = next
         maxsplit -= 1   # NB. if it's already < 0, it stays < 0
 
-    res_w.append(W_StringObject(space, value[:end]))
+    res_w.append(W_StringObject(value[:end]))
     res_w.reverse()
-    return W_ListObject(w_self.space, res_w)
+    return W_ListObject(res_w)
 
 def str_join__String_ANY(space, w_self, w_list):
     list = space.unpackiterable(w_list)
@@ -622,7 +618,7 @@
     else:
         u_centered = u_self
 
-    return W_StringObject(space, u_centered)
+    return W_StringObject(u_centered)
 
 def str_count__String_String_ANY_ANY(space, w_self, w_arg, w_start, w_end): 
     u_self  = w_self._value
@@ -646,7 +642,7 @@
             count += 1
             u_start = pos + len(u_arg)
        
-    return W_IntObject(space, count)
+    return wrapint(count)
 
 
 def str_endswith__String_String_ANY_ANY(space, w_self, w_suffix, w_start, w_end):
@@ -713,7 +709,7 @@
             u_expanded += " " * _tabindent(oldtoken,u_tabsize) + token
             oldtoken = token
             
-    return W_StringObject(space, u_expanded)        
+    return W_StringObject(u_expanded)        
  
  
 def str_splitlines__String_ANY(space, w_self, w_keepends):
@@ -734,13 +730,13 @@
             i += 1
         if u_keepends:
             eol = i
-        L.append(W_StringObject(space, data[j:eol]))
+        L.append(W_StringObject(data[j:eol]))
         j = i
 
     if j < selflen:
-        L.append(W_StringObject(space, data[j:]))
+        L.append(W_StringObject(data[j:]))
 
-    return W_ListObject(space, L)
+    return W_ListObject(L)
 
 def str_zfill__String_ANY(space, w_self, w_width):
     input = w_self._value
@@ -779,7 +775,7 @@
         x = _hash_string(s)    # to make sure we get the same hash as rpython
         # (otherwise translation will freeze W_DictObjects where we can't find
         #  the keys any more!)
-    return W_IntObject(space, x)
+    return wrapint(x)
 
 def lt__String_String(space, w_str1, w_str2):
     s1 = w_str1._value
@@ -839,13 +835,13 @@
         exc = space.call_function(space.w_IndexError,
                                   space.wrap("string index out of range"))
         raise OperationError(space.w_IndexError, exc)
-    return W_StringObject(space, str[ival])
+    return W_StringObject(str[ival])
 
 def getitem__String_Slice(space, w_str, w_slice):
     w = space.wrap
     s = w_str._value
     length = len(s)
-    start, stop, step, sl = w_slice.indices4(length)
+    start, stop, step, sl = w_slice.indices4(space, length)
     if sl == 0:
         str = ""
     elif step == 1:
@@ -853,7 +849,7 @@
         str = s[start:stop]
     else:
         str = "".join([s[start + i*step] for i in range(sl)])
-    return W_StringObject(space, str)
+    return W_StringObject(str)
 
 def _makebuf(length):
     """This helper needs to be a separate function so that we can safely
@@ -908,11 +904,11 @@
 def str__String(space, w_str):
     if type(w_str) is W_StringObject:
         return w_str
-    return W_StringObject(space, w_str._value)
+    return W_StringObject(w_str._value)
 
 def iter__String(space, w_list):
     from pypy.objspace.std import iterobject
-    return iterobject.W_SeqIterObject(space, w_list)
+    return iterobject.W_SeqIterObject(w_list)
 
 def ord__String(space, w_str):
     u_str = w_str._value
@@ -924,7 +920,7 @@
     return space.wrap(ord(u_str))
 
 def getnewargs__String(space, w_str):
-    return space.newtuple([W_StringObject(space, w_str._value)])
+    return space.newtuple([W_StringObject(w_str._value)])
 
 def repr__String(space, w_str):
     s = w_str._value

Modified: pypy/dist/pypy/objspace/std/stringtype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/stringtype.py	(original)
+++ pypy/dist/pypy/objspace/std/stringtype.py	Sat May  6 00:05:47 2006
@@ -48,7 +48,7 @@
         return w_obj  # XXX might be reworked when space.str() typechecks
     value = space.str_w(w_obj)
     w_obj = space.allocate_instance(W_StringObject, w_stringtype)
-    W_StringObject.__init__(w_obj, space, value)
+    W_StringObject.__init__(w_obj, value)
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/test/test_complexobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_complexobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_complexobject.py	Sat May  6 00:05:47 2006
@@ -12,7 +12,7 @@
 
     def _test_instantiation(self):
         def _t_complex(r=0.0,i=0.0):
-            c = cobj.W_ComplexObject(self.space, r, i)
+            c = cobj.W_ComplexObject(r, i)
             assert c.real == float(r) and c.imag == float(i)
         pairs = (
             (1, 1),
@@ -51,8 +51,8 @@
         assert cobj._powi((0.0,2.0),0) == (1.0,0.0)
         assert cobj._powi((0.0,0.0),2) == (0.0,0.0)
         assert cobj._powi((0.0,1.0),2) == (-1.0,0.0)
-        c = cobj.W_ComplexObject(self.space,0.0,1.0)
-        p = cobj.W_ComplexObject(self.space,2.0,0.0)
+        c = cobj.W_ComplexObject(0.0,1.0)
+        p = cobj.W_ComplexObject(2.0,0.0)
         r = cobj.pow__Complex_Complex_ANY(self.space,c,p,self.space.wrap(None))
         assert r.realval == -1.0
         assert r.imagval == 0.0

Modified: pypy/dist/pypy/objspace/std/test/test_floatobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_floatobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_floatobject.py	Sat May  6 00:05:47 2006
@@ -17,9 +17,9 @@
         x = 10.0
         y = 2.0
         z = 13.0
-        f1 = fobj.W_FloatObject(self.space, x)
-        f2 = fobj.W_FloatObject(self.space, y)
-        f3 = fobj.W_FloatObject(self.space, z)
+        f1 = fobj.W_FloatObject(x)
+        f2 = fobj.W_FloatObject(y)
+        f3 = fobj.W_FloatObject(z)
         assert self.space.w_TypeError == (
                           self._unwrap_nonimpl(fobj.pow__Float_Float_ANY,
                                                self.space, f1, f2, f3))
@@ -27,20 +27,20 @@
     def test_pow_ffn(self):
         x = 10.0
         y = 2.0
-        f1 = fobj.W_FloatObject(self.space, x)
-        f2 = fobj.W_FloatObject(self.space, y)
+        f1 = fobj.W_FloatObject(x)
+        f2 = fobj.W_FloatObject(y)
         v = fobj.pow__Float_Float_ANY(self.space, f1, f2, self.space.w_None)
         assert v.floatval == x ** y
-        f1 = fobj.W_FloatObject(self.space, -1.23)
-        f2 = fobj.W_FloatObject(self.space, -4.56)
+        f1 = fobj.W_FloatObject(-1.23)
+        f2 = fobj.W_FloatObject(-4.56)
         assert self.space.w_ValueError == (
                           self._unwrap_nonimpl(fobj.pow__Float_Float_ANY,
                                                self.space, f1, f2,
                                                self.space.w_None))
         x = -10
         y = 2.0
-        f1 = fobj.W_FloatObject(self.space, x)
-        f2 = fobj.W_FloatObject(self.space, y)
+        f1 = fobj.W_FloatObject(x)
+        f2 = fobj.W_FloatObject(y)
         v = fobj.pow__Float_Float_ANY(self.space, f1, f2, self.space.w_None)
         assert v.floatval == x**y
 

Modified: pypy/dist/pypy/objspace/std/test/test_intobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_intobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_intobject.py	Sat May  6 00:05:47 2006
@@ -37,19 +37,19 @@
         
     def test_repr(self):
         x = 1
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         result = iobj.repr__Int(self.space, f1)
         assert self.space.unwrap(result) == repr(x)
 
     def test_str(self):
         x = 12345
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         result = iobj.str__Int(self.space, f1)
         assert self.space.unwrap(result) == str(x)
 
     def test_hash(self):
         x = 42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         result = iobj.hash__Int(self.space, f1)
         assert result.intval == hash(x)
 
@@ -59,8 +59,8 @@
         for x in (-10, -1, 0, 1, 2, 1000, sys.maxint):
             for y in (-sys.maxint-1, -11, -9, -2, 0, 1, 3, 1111, sys.maxint):
                 for op in optab:
-                    wx = iobj.W_IntObject(self.space, x)
-                    wy = iobj.W_IntObject(self.space, y)
+                    wx = iobj.W_IntObject(x)
+                    wy = iobj.W_IntObject(y)
                     res = getattr(operator, op)(x, y)
                     method = getattr(iobj, '%s__Int_Int' % op)
                     myres = method(self.space, wx, wy)
@@ -69,64 +69,64 @@
     def test_add(self):
         x = 1
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         result = iobj.add__Int_Int(self.space, f1, f2)
         assert result.intval == x+y
         x = sys.maxint
         y = 1
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.add__Int_Int, self.space, f1, f2))
 
     def test_sub(self):
         x = 1
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         result = iobj.sub__Int_Int(self.space, f1, f2)
         assert result.intval == x-y
         x = sys.maxint
         y = -1
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.sub__Int_Int, self.space, f1, f2))
 
     def test_mul(self):
         x = 2
         y = 3
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         result = iobj.mul__Int_Int(self.space, f1, f2)
         assert result.intval == x*y
         x = -sys.maxint-1
         y = -1
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.mul__Int_Int, self.space, f1, f2))
 
     def test_div(self):
         for i in range(10):
             res = i//3
-            f1 = iobj.W_IntObject(self.space, i)
-            f2 = iobj.W_IntObject(self.space, 3)
+            f1 = iobj.W_IntObject(i)
+            f2 = iobj.W_IntObject(3)
             result = iobj.div__Int_Int(self.space, f1, f2)
             assert result.intval == res
         x = -sys.maxint-1
         y = -1
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.div__Int_Int, self.space, f1, f2))
 
     def test_mod(self):
         x = 1
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.mod__Int_Int(self.space, f1, f2)
         assert v.intval == x % y
         # not that mod cannot overflow
@@ -134,15 +134,15 @@
     def test_divmod(self):
         x = 1
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         ret = iobj.divmod__Int_Int(self.space, f1, f2)
         v, w = self.space.unwrap(ret)
         assert (v, w) == divmod(x, y)
         x = -sys.maxint-1
         y = -1
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.divmod__Int_Int, self.space, f1, f2))
 
@@ -150,16 +150,16 @@
         x = 10
         y = 2
         z = 13
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
-        f3 = iobj.W_IntObject(self.space, z)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
+        f3 = iobj.W_IntObject(z)
         v = iobj.pow__Int_Int_Int(self.space, f1, f2, f3)
         assert v.intval == pow(x, y, z)
-        f1, f2, f3 = [iobj.W_IntObject(self.space, i) for i in (10, -1, 42)]
+        f1, f2, f3 = [iobj.W_IntObject(i) for i in (10, -1, 42)]
         self.space.raises_w(self.space.w_TypeError,
                             iobj.pow__Int_Int_Int,
                             self.space, f1, f2, f3)
-        f1, f2, f3 = [iobj.W_IntObject(self.space, i) for i in (10, 5, 0)]
+        f1, f2, f3 = [iobj.W_IntObject(i) for i in (10, 5, 0)]
         self.space.raises_w(self.space.w_ValueError,
                             iobj.pow__Int_Int_Int,
                             self.space, f1, f2, f3)
@@ -167,125 +167,125 @@
     def test_pow_iin(self):
         x = 10
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.pow__Int_Int_None(self.space, f1, f2, self.space.w_None)
         assert v.intval == x ** y
-        f1, f2 = [iobj.W_IntObject(self.space, i) for i in (10, 20)]
+        f1, f2 = [iobj.W_IntObject(i) for i in (10, 20)]
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.pow__Int_Int_None, self.space, f1, f2, self.space.w_None))
 
     def test_neg(self):
         x = 42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.neg__Int(self.space, f1)
         assert v.intval == -x
         x = -sys.maxint-1
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.neg__Int, self.space, f1))
 
     def test_pos(self):
         x = 42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.pos__Int(self.space, f1)
         assert v.intval == +x
         x = -42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.pos__Int(self.space, f1)
         assert v.intval == +x
 
     def test_abs(self):
         x = 42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.abs__Int(self.space, f1)
         assert v.intval == abs(x)
         x = -42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.abs__Int(self.space, f1)
         assert v.intval == abs(x)
         x = -sys.maxint-1
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.abs__Int, self.space, f1))
 
     def test_invert(self):
         x = 42
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         v = iobj.invert__Int(self.space, f1)
         assert v.intval == ~x
 
     def test_lshift(self):
         x = 12345678
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.lshift__Int_Int(self.space, f1, f2)
         assert v.intval == x << y
         y = self._longshiftresult(x)
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         assert self.space.w_OverflowError == (
                           self._unwrap_nonimpl(iobj.lshift__Int_Int, self.space, f1, f2))
 
     def test_rshift(self):
         x = 12345678
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.rshift__Int_Int(self.space, f1, f2)
         assert v.intval == x >> y
 
     def test_and(self):
         x = 12345678
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.and__Int_Int(self.space, f1, f2)
         assert v.intval == x & y
 
     def test_xor(self):
         x = 12345678
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.xor__Int_Int(self.space, f1, f2)
         assert v.intval == x ^ y
 
     def test_or(self):
         x = 12345678
         y = 2
-        f1 = iobj.W_IntObject(self.space, x)
-        f2 = iobj.W_IntObject(self.space, y)
+        f1 = iobj.W_IntObject(x)
+        f2 = iobj.W_IntObject(y)
         v = iobj.or__Int_Int(self.space, f1, f2)
         assert v.intval == x | y
 
     def test_int(self):
-        f1 = iobj.W_IntObject(self.space, 1)
+        f1 = iobj.W_IntObject(1)
         result = iobj.int__Int(self.space, f1)
         assert result == f1
 
 ##    def test_long(self):
 ##        x = 1
-##        f1 = iobj.W_IntObject(self.space, x)
+##        f1 = iobj.W_IntObject(x)
 ##        result = iobj.int_long(self.space, f1)
 ##        self.assertEquals(self.space.unwrap(result), long(x))
 
 ##    def test_float(self):
 ##        x = 1
-##        f1 = iobj.W_IntObject(self.space, x)
+##        f1 = iobj.W_IntObject(x)
 ##        result = iobj.int_float(self.space, f1)
 ##        self.assertEquals(self.space.unwrap(result), float(x))
 
     def test_oct(self):
         x = 012345
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         result = iobj.oct__Int(self.space, f1)
         assert self.space.unwrap(result) == oct(x)
 
     def test_hex(self):
         x = 0x12345
-        f1 = iobj.W_IntObject(self.space, x)
+        f1 = iobj.W_IntObject(x)
         result = iobj.hex__Int(self.space, f1)
         assert self.space.unwrap(result) == hex(x)
 

Modified: pypy/dist/pypy/objspace/std/test/test_iterobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_iterobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_iterobject.py	Sat May  6 00:05:47 2006
@@ -18,7 +18,7 @@
     def test_iter(self):
         w = self.space.wrap
         w_tuple = self.space.newtuple([w(5), w(3), w(99)])
-        w_iter = W_SeqIterObject(self.space, w_tuple)
+        w_iter = W_SeqIterObject(w_tuple)
         self.body3(w_iter)
         
     def test_iter_builtin(self):
@@ -29,7 +29,7 @@
 
     def test_emptyiter(self):
         w_list = self.space.newlist([])
-        w_iter = W_SeqIterObject(self.space, w_list)
+        w_iter = W_SeqIterObject(w_list)
         self.body0(w_iter)
         
     def test_emptyiter_builtin(self):

Modified: pypy/dist/pypy/objspace/std/test/test_listobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_listobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_listobject.py	Sat May  6 00:05:47 2006
@@ -9,25 +9,25 @@
 
     def test_is_true(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [])
+        w_list = W_ListObject([])
         assert self.space.is_true(w_list) == False
-        w_list = W_ListObject(self.space, [w(5)])
+        w_list = W_ListObject([w(5)])
         assert self.space.is_true(w_list) == True
-        w_list = W_ListObject(self.space, [w(5), w(3)])
+        w_list = W_ListObject([w(5), w(3)])
         assert self.space.is_true(w_list) == True
 
     def test_len(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [])
+        w_list = W_ListObject([])
         assert self.space.eq_w(self.space.len(w_list), w(0))
-        w_list = W_ListObject(self.space, [w(5)])
+        w_list = W_ListObject([w(5)])
         assert self.space.eq_w(self.space.len(w_list), w(1))
-        w_list = W_ListObject(self.space, [w(5), w(3), w(99)]*111)
+        w_list = W_ListObject([w(5), w(3), w(99)]*111)
         assert self.space.eq_w(self.space.len(w_list), w(333))
  
     def test_getitem(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [w(5), w(3)])
+        w_list = W_ListObject([w(5), w(3)])
         assert self.space.eq_w(self.space.getitem(w_list, w(0)), w(5))
         assert self.space.eq_w(self.space.getitem(w_list, w(1)), w(3))
         assert self.space.eq_w(self.space.getitem(w_list, w(-2)), w(5))
@@ -42,7 +42,7 @@
     def test_random_getitem(self):
         w = self.space.wrap
         s = list('qedx387tn3uixhvt 7fh387fymh3dh238 dwd-wq.dwq9')
-        w_list = W_ListObject(self.space, map(w, s))
+        w_list = W_ListObject(map(w, s))
         keys = range(-len(s)-5, len(s)+5)
         choices = keys + [None]*12
         stepchoices = [None, None, None, 1, 1, -1, -1, 2, -2,
@@ -65,7 +65,7 @@
 
     def test_iter(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [w(5), w(3), w(99)])
+        w_list = W_ListObject([w(5), w(3), w(99)])
         w_iter = self.space.iter(w_list)
         assert self.space.eq_w(self.space.next(w_iter), w(5))
         assert self.space.eq_w(self.space.next(w_iter), w(3))
@@ -75,7 +75,7 @@
 
     def test_contains(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [w(5), w(3), w(99)])
+        w_list = W_ListObject([w(5), w(3), w(99)])
         assert self.space.eq_w(self.space.contains(w_list, w(5)),
                            self.space.w_True)
         assert self.space.eq_w(self.space.contains(w_list, w(99)),
@@ -90,7 +90,7 @@
 
         def test1(testlist, start, stop, step, expected):
             w_slice  = self.space.newslice(w(start), w(stop), w(step))
-            w_list = W_ListObject(self.space, [w(i) for i in testlist])
+            w_list = W_ListObject([w(i) for i in testlist])
             w_result = self.space.getitem(w_list, w_slice)
             assert self.space.unwrap(w_result) == expected
         
@@ -111,8 +111,8 @@
 
         def test1(lhslist, start, stop, rhslist, expected):
             w_slice  = self.space.newslice(w(start), w(stop), w(1))
-            w_lhslist = W_ListObject(self.space, [w(i) for i in lhslist])
-            w_rhslist = W_ListObject(self.space, [w(i) for i in rhslist])
+            w_lhslist = W_ListObject([w(i) for i in lhslist])
+            w_rhslist = W_ListObject([w(i) for i in rhslist])
             self.space.setitem(w_lhslist, w_slice, w_rhslist)
             assert self.space.unwrap(w_lhslist) == expected
         
@@ -126,14 +126,14 @@
 
     def test_add(self):
         w = self.space.wrap
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(-7)] * 111)
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(-7)] * 111)
         assert self.space.eq_w(self.space.add(w_list1, w_list1),
-                           W_ListObject(self.space, [w(5), w(3), w(99),
+                           W_ListObject([w(5), w(3), w(99),
                                                w(5), w(3), w(99)]))
         assert self.space.eq_w(self.space.add(w_list1, w_list2),
-                           W_ListObject(self.space, [w(5), w(3), w(99)] +
+                           W_ListObject([w(5), w(3), w(99)] +
                                               [w(-7)] * 111))
         assert self.space.eq_w(self.space.add(w_list1, w_list0), w_list1)
         assert self.space.eq_w(self.space.add(w_list0, w_list2), w_list2)
@@ -143,8 +143,8 @@
         w = self.space.wrap
         arg = w(2)
         n = 3
-        w_lis = W_ListObject(self.space, [arg])
-        w_lis3 = W_ListObject(self.space, [arg]*n)
+        w_lis = W_ListObject([arg])
+        w_lis3 = W_ListObject([arg]*n)
         w_res = self.space.mul(w_lis, w(n))
         assert self.space.eq_w(w_lis3, w_res)
         # commute
@@ -153,9 +153,9 @@
 
     def test_setitem(self):
         w = self.space.wrap
-        w_list = W_ListObject(self.space, [w(5), w(3)])
-        w_exp1 = W_ListObject(self.space, [w(5), w(7)])
-        w_exp2 = W_ListObject(self.space, [w(8), w(7)])
+        w_list = W_ListObject([w(5), w(3)])
+        w_exp1 = W_ListObject([w(5), w(7)])
+        w_exp2 = W_ListObject([w(8), w(7)])
         self.space.setitem(w_list, w(1), w(7))
         assert self.space.eq_w(w_exp1, w_list)
         self.space.setitem(w_list, w(-2), w(8))
@@ -168,7 +168,7 @@
     def test_random_setitem_delitem(self):
         w = self.space.wrap
         s = range(39)
-        w_list = W_ListObject(self.space, map(w, s))
+        w_list = W_ListObject(map(w, s))
         expected = list(s)
         keys = range(-len(s)-5, len(s)+5)
         choices = keys + [None]*12
@@ -184,7 +184,7 @@
         for key in keys:
             if random.random() < 0.15:
                 random.shuffle(s)
-                w_list = W_ListObject(self.space, map(w, s))
+                w_list = W_ListObject(map(w, s))
                 expected = list(s)
             try:
                 value = expected[key]
@@ -220,10 +220,10 @@
     def test_eq(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
 
         assert self.space.eq_w(self.space.eq(w_list0, w_list1),
                            self.space.w_False)
@@ -238,10 +238,10 @@
     def test_ne(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
 
         assert self.space.eq_w(self.space.ne(w_list0, w_list1),
                            self.space.w_True)
@@ -256,11 +256,11 @@
     def test_lt(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_list4 = W_ListObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
+        w_list4 = W_ListObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.lt(w_list0, w_list1),
                            self.space.w_True)
@@ -278,11 +278,11 @@
     def test_ge(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_list4 = W_ListObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
+        w_list4 = W_ListObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.ge(w_list0, w_list1),
                            self.space.w_False)
@@ -300,11 +300,11 @@
     def test_gt(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_list4 = W_ListObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
+        w_list4 = W_ListObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.gt(w_list0, w_list1),
                            self.space.w_False)
@@ -322,11 +322,11 @@
     def test_le(self):
         w = self.space.wrap
         
-        w_list0 = W_ListObject(self.space, [])
-        w_list1 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list2 = W_ListObject(self.space, [w(5), w(3), w(99)])
-        w_list3 = W_ListObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_list4 = W_ListObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_list0 = W_ListObject([])
+        w_list1 = W_ListObject([w(5), w(3), w(99)])
+        w_list2 = W_ListObject([w(5), w(3), w(99)])
+        w_list3 = W_ListObject([w(5), w(3), w(99), w(-1)])
+        w_list4 = W_ListObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.le(w_list0, w_list1),
                            self.space.w_True)

Modified: pypy/dist/pypy/objspace/std/test/test_longobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_longobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_longobject.py	Sat May  6 00:05:47 2006
@@ -23,8 +23,8 @@
         y = 123858582373821923936744221L
         for i in [-1, 1]:
             for j in [-1, 1]:
-                f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x * i))
-                f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y * j))
+                f1 = lobj.W_LongObject(*lobj.args_from_long(x * i))
+                f2 = lobj.W_LongObject(*lobj.args_from_long(y * j))
                 result = lobj.add__Long_Long(self.space, f1, f2)
                 assert result.longval() == x * i + y * j
 
@@ -33,20 +33,20 @@
         y = 88961284756491823819191823L
         for i in [-1, 1]:
             for j in [-1, 1]:
-                f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x * i))
-                f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y * j))
+                f1 = lobj.W_LongObject(*lobj.args_from_long(x * i))
+                f2 = lobj.W_LongObject(*lobj.args_from_long(y * j))
                 result = lobj.sub__Long_Long(self.space, f1, f2)
                 assert result.longval() == x * i - y * j
 
     def test_subzz(self):
-        w_l0 = lobj.W_LongObject(self.space, [0])
+        w_l0 = lobj.W_LongObject([0])
         assert self.space.sub(w_l0, w_l0).longval() == 0
 
     def test_mul(self):
         x = -1238585838347L
         y = 585839391919233L
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-        f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+        f2 = lobj.W_LongObject(*lobj.args_from_long(y))
         result = lobj.mul__Long_Long(self.space, f1, f2)
         assert result.longval() == x * y
         # also test a * a, it has special code
@@ -57,7 +57,7 @@
         # signs are not handled in the helpers!
         x = 1238585838347L
         y = 3
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
         f2 = y
         remainder = lobj._inplace_divrem1(f1, f1, f2)
         assert (f1.longval(), remainder) == divmod(x, y)
@@ -66,7 +66,7 @@
         # signs are not handled in the helpers!
         x = 1238585838347L
         y = 3
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
         f2 = y
         div, rem = lobj._divrem1(f1, f2)
         assert (div.longval(), rem) == divmod(x, y)
@@ -75,7 +75,7 @@
         x = 1238585838347L
         y = 3
         z = 42
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
         f2 = y
         f3 = z
         prod = lobj._muladd1(f1, f2, f3)
@@ -87,8 +87,8 @@
             y = long(randint(0, 1 << 30))
             y <<= 30
             y += randint(0, 1 << 30)
-            f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-            f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+            f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+            f2 = lobj.W_LongObject(*lobj.args_from_long(y))
             div, rem = lobj._x_divrem(f1, f2)
             assert div.longval(), rem.longval() == divmod(x, y)
 
@@ -101,18 +101,18 @@
             for sx, sy in (1, 1), (1, -1), (-1, -1), (-1, 1):
                 sx *= x
                 sy *= y
-                f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(sx))
-                f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(sy))
+                f1 = lobj.W_LongObject(*lobj.args_from_long(sx))
+                f2 = lobj.W_LongObject(*lobj.args_from_long(sy))
                 div, rem = lobj._x_divrem(f1, f2)
                 assert div.longval(), rem.longval() == divmod(sx, sy)
 
     def test__AsDouble(self):
         x = 12345678901234567890L ** 10
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
         d = lobj._AsDouble(f1)
         assert d == float(x)
         x = x ** 100
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
         assert raises(OverflowError, lobj._AsDouble, f1)
 
     def test__FromDouble(self):
@@ -129,15 +129,15 @@
 
     # testing Karatsuba stuff
     def test__v_iadd(self):
-        f1 = lobj.W_LongObject(self.space, [lobj.MASK] * 10, 1)
-        f2 = lobj.W_LongObject(self.space, [1], 1)
+        f1 = lobj.W_LongObject([lobj.MASK] * 10, 1)
+        f2 = lobj.W_LongObject([1], 1)
         carry = lobj._v_iadd(f1.digits, 1, len(f1.digits)-1, f2.digits, 1)
         assert carry == 1
         assert f1.longval() == lobj.MASK
 
     def test__v_isub(self):
-        f1 = lobj.W_LongObject(self.space, [lobj.MASK] + [0] * 9 + [1], 1)
-        f2 = lobj.W_LongObject(self.space, [1], 1)
+        f1 = lobj.W_LongObject([lobj.MASK] + [0] * 9 + [1], 1)
+        f2 = lobj.W_LongObject([1], 1)
         borrow = lobj._v_isub(f1.digits, 1, len(f1.digits)-1, f2.digits, 1)
         assert borrow == 0
         assert f1.longval() == (1 << lobj.SHIFT) ** 10 - 1
@@ -146,32 +146,32 @@
         split = 5
         diglo = [0] * split
         dighi = [lobj.MASK] * split
-        f1 = lobj.W_LongObject(self.space, diglo + dighi, 1)
+        f1 = lobj.W_LongObject(diglo + dighi, 1)
         hi, lo = lobj._kmul_split(f1, split)
         assert lo.digits == [0]
         assert hi.digits == dighi
 
     def test__k_mul(self):
         digs= lobj.KARATSUBA_CUTOFF * 5
-        f1 = lobj.W_LongObject(self.space, [lobj.MASK] * digs, 1)
-        f2 = lobj._x_add(f1,lobj.W_LongObject(self.space, [1], 1))
+        f1 = lobj.W_LongObject([lobj.MASK] * digs, 1)
+        f2 = lobj._x_add(f1,lobj.W_LongObject([1], 1))
         ret = lobj._k_mul(f1, f2)
         assert ret.longval() == f1.longval() * f2.longval()
 
     def test__k_lopsided_mul(self):
         digs_a = lobj.KARATSUBA_CUTOFF + 3
         digs_b = 3 * digs_a
-        f1 = lobj.W_LongObject(self.space, [lobj.MASK] * digs_a, 1)
-        f2 = lobj.W_LongObject(self.space, [lobj.MASK] * digs_b, 1)
+        f1 = lobj.W_LongObject([lobj.MASK] * digs_a, 1)
+        f2 = lobj.W_LongObject([lobj.MASK] * digs_b, 1)
         ret = lobj._k_lopsided_mul(f1, f2)
         assert ret.longval() == f1.longval() * f2.longval()
 
     def test_eq(self):
         x = 5858393919192332223L
         y = 585839391919233111223311112332L
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-        f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(-x))
-        f3 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+        f2 = lobj.W_LongObject(*lobj.args_from_long(-x))
+        f3 = lobj.W_LongObject(*lobj.args_from_long(y))
         assert self.space.is_true(lobj.eq__Long_Long(self.space, f1, f1))
         assert self.space.is_true(lobj.eq__Long_Long(self.space, f2, f2))
         assert self.space.is_true(lobj.eq__Long_Long(self.space, f3, f3))
@@ -182,14 +182,14 @@
         val = [0, 0x111111111111, 0x111111111112, 0x111111111112FFFF]
         for x in gen_signs(val):
             for y in gen_signs(val):
-                f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-                f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+                f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+                f2 = lobj.W_LongObject(*lobj.args_from_long(y))
                 assert (x < y) ==  self.space.is_true(
                     lobj.lt__Long_Long(self.space, f1, f2))
 
     def test_int_conversion(self):
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(12332))
-        f2 = lobj.delegate_Int2Long(self.space.newint(12332))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(12332))
+        f2 = lobj.delegate_Int2Long(self.space, self.space.newint(12332))
         assert f2.longval() == f1.longval()
         assert lobj.int__Long(self.space, f2).intval == 12332
         assert lobj.int_w__Long(self.space, f2) == 12332
@@ -203,9 +203,10 @@
     def test_conversions(self):
         space = self.space
         for v in (0, 1, -1, sys.maxint, -sys.maxint-1):
-            assert lobj.W_LongObject(self.space, *lobj.args_from_long(v)).longval() == v
+            assert lobj.W_LongObject(*lobj.args_from_long(v)).longval() == v
             w_v = space.newint(v)
-            for w_lv in (lobj.long__Int(space, w_v), lobj.delegate_Int2Long(w_v)):
+            for w_lv in (lobj.long__Int(space, w_v),
+                         lobj.delegate_Int2Long(self.space, w_v)):
                 assert w_lv.longval() == v
                 assert lobj.int_w__Long(space, w_lv) == v
                 assert space.is_true(space.isinstance(lobj.int__Long(space, w_lv), space.w_int))            
@@ -218,19 +219,19 @@
                 else:
                     space.raises_w(space.w_ValueError, lobj.uint_w__Long, space, w_lv)
 
-        w_toobig_lv1 = lobj.W_LongObject(space, *lobj.args_from_long(sys.maxint+1))
+        w_toobig_lv1 = lobj.W_LongObject(*lobj.args_from_long(sys.maxint+1))
         assert w_toobig_lv1.longval() == sys.maxint+1
-        w_toobig_lv2 = lobj.W_LongObject(space, *lobj.args_from_long(sys.maxint+2))
+        w_toobig_lv2 = lobj.W_LongObject(*lobj.args_from_long(sys.maxint+2))
         assert w_toobig_lv2.longval() == sys.maxint+2
-        w_toobig_lv3 = lobj.W_LongObject(space, *lobj.args_from_long(-sys.maxint-2))
+        w_toobig_lv3 = lobj.W_LongObject(*lobj.args_from_long(-sys.maxint-2))
         assert w_toobig_lv3.longval() == -sys.maxint-2        
 
         for w_lv in (w_toobig_lv1, w_toobig_lv2, w_toobig_lv3):            
             space.raises_w(space.w_OverflowError, lobj.int_w__Long, space, w_lv)
             assert space.is_true(space.isinstance(lobj.int__Long(space, w_lv), space.w_long))
 
-        w_lmaxuint = lobj.W_LongObject(space, *lobj.args_from_long(2*sys.maxint+1))
-        w_toobig_lv4 = lobj.W_LongObject(space, *lobj.args_from_long(2*sys.maxint+2))        
+        w_lmaxuint = lobj.W_LongObject(*lobj.args_from_long(2*sys.maxint+1))
+        w_toobig_lv4 = lobj.W_LongObject(*lobj.args_from_long(2*sys.maxint+2))        
 
         u = lobj.uint_w__Long(space, w_lmaxuint)
         assert u == 2*sys.maxint+1
@@ -244,17 +245,17 @@
         x = 10L
         y = 2L
         z = 13L
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-        f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
-        f3 = lobj.W_LongObject(self.space, *lobj.args_from_long(z))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+        f2 = lobj.W_LongObject(*lobj.args_from_long(y))
+        f3 = lobj.W_LongObject(*lobj.args_from_long(z))
         v = lobj.pow__Long_Long_Long(self.space, f1, f2, f3)
         assert v.longval() == pow(x, y, z)
-        f1, f2, f3 = [lobj.W_LongObject(self.space, *lobj.args_from_long(i))
+        f1, f2, f3 = [lobj.W_LongObject(*lobj.args_from_long(i))
                       for i in (10L, -1L, 42L)]
         self.space.raises_w(self.space.w_TypeError,
                             lobj.pow__Long_Long_Long,
                             self.space, f1, f2, f3)
-        f1, f2, f3 = [lobj.W_LongObject(self.space, *lobj.args_from_long(i))
+        f1, f2, f3 = [lobj.W_LongObject(*lobj.args_from_long(i))
                       for i in (10L, 5L, 0L)]
         self.space.raises_w(self.space.w_ValueError,
                             lobj.pow__Long_Long_Long,
@@ -263,33 +264,33 @@
     def test_pow_lln(self):
         x = 10L
         y = 2L
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-        f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+        f2 = lobj.W_LongObject(*lobj.args_from_long(y))
         v = lobj.pow__Long_Long_None(self.space, f1, f2, self.space.w_None)
         assert v.longval() == x ** y
 
     def test_normalize(self):
-        f1 = lobj.W_LongObject(self.space, [1, 0], 1)
+        f1 = lobj.W_LongObject([1, 0], 1)
         f1._normalize()
         assert len(f1.digits) == 1
-        f0 = lobj.W_LongObject(self.space, [0], 0)
+        f0 = lobj.W_LongObject([0], 0)
         assert self.space.is_true(
             self.space.eq(lobj.sub__Long_Long(self.space, f1, f1), f0))
 
     def test_invert(self):
         x = 3 ** 40
-        f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
-        f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(-x))
+        f1 = lobj.W_LongObject(*lobj.args_from_long(x))
+        f2 = lobj.W_LongObject(*lobj.args_from_long(-x))
         r1 = lobj.invert__Long(self.space, f1)
         r2 = lobj.invert__Long(self.space, f2)
         assert r1.longval() == -(x + 1)
         assert r2.longval() == -(-x + 1)
 
     def test_shift(self):
-        negative = lobj.W_LongObject(self.space, *lobj.args_from_long(-23))
-        big = lobj.W_LongObject(self.space, *lobj.args_from_long(2L ** 100L))
+        negative = lobj.W_LongObject(*lobj.args_from_long(-23))
+        big = lobj.W_LongObject(*lobj.args_from_long(2L ** 100L))
         for x in gen_signs([3L ** 30L, 5L ** 20L, 7 ** 300, 0L, 1L]):
-            f1 = lobj.W_LongObject(self.space, *lobj.args_from_long(x))
+            f1 = lobj.W_LongObject(*lobj.args_from_long(x))
             self.space.raises_w(self.space.w_ValueError,
                                 lobj.lshift__Long_Long, self.space, f1,
                                 negative)
@@ -303,7 +304,7 @@
                                 lobj.rshift__Long_Long, self.space, f1,
                                 big)                                
             for y in [0L, 1L, 32L, 2304L, 11233L, 3 ** 9]:
-                f2 = lobj.W_LongObject(self.space, *lobj.args_from_long(y))
+                f2 = lobj.W_LongObject(*lobj.args_from_long(y))
                 res1 = lobj.lshift__Long_Long(self.space, f1, f2).longval()
                 res2 = lobj.rshift__Long_Long(self.space, f1, f2).longval()
                 assert res1 == x << y

Modified: pypy/dist/pypy/objspace/std/test/test_multimethod.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_multimethod.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_multimethod.py	Sat May  6 00:05:47 2006
@@ -16,7 +16,7 @@
 class W_StringObject(W_Root):
     pass
 
-def delegate_b2i(w_x):
+def delegate_b2i(space, w_x):
     assert isinstance(w_x, W_BoolObject)
     return W_IntObject()
 

Modified: pypy/dist/pypy/objspace/std/test/test_sliceobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_sliceobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_sliceobject.py	Sat May  6 00:05:47 2006
@@ -8,18 +8,18 @@
         w = space.wrap
         w_None = space.w_None
         w_slice = space.newslice(w_None, w_None, w_None)
-        assert w_slice.indices3(6) == (0, 6, 1)
+        assert w_slice.indices3(space, 6) == (0, 6, 1)
         w_slice = space.newslice(w(0), w(6), w(1))
-        assert w_slice.indices3(6) == (0, 6, 1)
+        assert w_slice.indices3(space, 6) == (0, 6, 1)
         w_slice = space.newslice(w_None, w_None, w(-1))
-        assert w_slice.indices3(6) == (5, -1, -1)
+        assert w_slice.indices3(space, 6) == (5, -1, -1)
 
     def test_indices_fail(self):
         space = self.space
         w = space.wrap
         w_None = space.w_None
         w_slice = space.newslice(w_None, w_None, w(0))
-        self.space.raises_w(space.w_ValueError, w_slice.indices3, 10)
+        self.space.raises_w(space.w_ValueError, w_slice.indices3, space, 10)
 
 
 class AppTest_SliceObject:

Modified: pypy/dist/pypy/objspace/std/test/test_tupleobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/test/test_tupleobject.py	(original)
+++ pypy/dist/pypy/objspace/std/test/test_tupleobject.py	Sat May  6 00:05:47 2006
@@ -9,25 +9,25 @@
 
     def test_is_true(self):
         w = self.space.wrap
-        w_tuple = W_TupleObject(self.space, [])
+        w_tuple = W_TupleObject([])
         assert self.space.is_true(w_tuple) == False
-        w_tuple = W_TupleObject(self.space, [w(5)])
+        w_tuple = W_TupleObject([w(5)])
         assert self.space.is_true(w_tuple) == True
-        w_tuple = W_TupleObject(self.space, [w(5), w(3)])
+        w_tuple = W_TupleObject([w(5), w(3)])
         assert self.space.is_true(w_tuple) == True
 
     def test_len(self):
         w = self.space.wrap
-        w_tuple = W_TupleObject(self.space, [])
+        w_tuple = W_TupleObject([])
         assert self.space.eq_w(self.space.len(w_tuple), w(0))
-        w_tuple = W_TupleObject(self.space, [w(5)])
+        w_tuple = W_TupleObject([w(5)])
         assert self.space.eq_w(self.space.len(w_tuple), w(1))
-        w_tuple = W_TupleObject(self.space, [w(5), w(3), w(99)]*111)
+        w_tuple = W_TupleObject([w(5), w(3), w(99)]*111)
         assert self.space.eq_w(self.space.len(w_tuple), w(333))
 
     def test_getitem(self):
         w = self.space.wrap
-        w_tuple = W_TupleObject(self.space, [w(5), w(3)])
+        w_tuple = W_TupleObject([w(5), w(3)])
         assert self.space.eq_w(self.space.getitem(w_tuple, w(0)), w(5))
         assert self.space.eq_w(self.space.getitem(w_tuple, w(1)), w(3))
         assert self.space.eq_w(self.space.getitem(w_tuple, w(-2)), w(5))
@@ -41,7 +41,7 @@
 
     def test_iter(self):
         w = self.space.wrap
-        w_tuple = W_TupleObject(self.space, [w(5), w(3), w(99)])
+        w_tuple = W_TupleObject([w(5), w(3), w(99)])
         w_iter = self.space.iter(w_tuple)
         assert self.space.eq_w(self.space.next(w_iter), w(5))
         assert self.space.eq_w(self.space.next(w_iter), w(3))
@@ -51,7 +51,7 @@
 
     def test_contains(self):
         w = self.space.wrap
-        w_tuple = W_TupleObject(self.space, [w(5), w(3), w(99)])
+        w_tuple = W_TupleObject([w(5), w(3), w(99)])
         assert self.space.eq_w(self.space.contains(w_tuple, w(5)),
                            self.space.w_True)
         assert self.space.eq_w(self.space.contains(w_tuple, w(99)),
@@ -63,15 +63,14 @@
 
     def test_add(self):
         w = self.space.wrap
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(-7)] * 111)
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(-7)] * 111)
         assert self.space.eq_w(self.space.add(w_tuple1, w_tuple1),
-                           W_TupleObject(self.space, [w(5), w(3), w(99),
+                           W_TupleObject([w(5), w(3), w(99),
                                                       w(5), w(3), w(99)]))
         assert self.space.eq_w(self.space.add(w_tuple1, w_tuple2),
-                           W_TupleObject(self.space,
-                                         [w(5), w(3), w(99)] + [w(-7)] * 111))
+                           W_TupleObject([w(5), w(3), w(99)] + [w(-7)] * 111))
         assert self.space.eq_w(self.space.add(w_tuple1, w_tuple0), w_tuple1)
         assert self.space.eq_w(self.space.add(w_tuple0, w_tuple2), w_tuple2)
 
@@ -80,8 +79,8 @@
         w = self.space.wrap
         arg = w(2)
         n = 3
-        w_tup = W_TupleObject(self.space, [arg])
-        w_tup3 = W_TupleObject(self.space, [arg]*n)
+        w_tup = W_TupleObject([arg])
+        w_tup3 = W_TupleObject([arg]*n)
         w_res = self.space.mul(w_tup, w(n))
         assert self.space.eq_w(w_tup3, w_res)
         # commute
@@ -93,7 +92,7 @@
 
         def test1(testtuple, start, stop, step, expected):
             w_slice  = self.space.newslice(w(start), w(stop), w(step))
-            w_tuple = W_TupleObject(self.space, [w(i) for i in testtuple])
+            w_tuple = W_TupleObject([w(i) for i in testtuple])
             w_result = self.space.getitem(w_tuple, w_slice)
             assert self.space.unwrap(w_result) == expected
         
@@ -112,10 +111,10 @@
     def test_eq(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
 
         assert self.space.eq_w(self.space.eq(w_tuple0, w_tuple1),
                            self.space.w_False)
@@ -130,10 +129,10 @@
     def test_ne(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
 
         assert self.space.eq_w(self.space.ne(w_tuple0, w_tuple1),
                            self.space.w_True)
@@ -148,11 +147,11 @@
     def test_lt(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_tuple4 = W_TupleObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
+        w_tuple4 = W_TupleObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.lt(w_tuple0, w_tuple1),
                            self.space.w_True)
@@ -170,11 +169,11 @@
     def test_ge(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_tuple4 = W_TupleObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
+        w_tuple4 = W_TupleObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.ge(w_tuple0, w_tuple1),
                            self.space.w_False)
@@ -192,11 +191,11 @@
     def test_gt(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_tuple4 = W_TupleObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
+        w_tuple4 = W_TupleObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.gt(w_tuple0, w_tuple1),
                            self.space.w_False)
@@ -214,11 +213,11 @@
     def test_le(self):
         w = self.space.wrap
         
-        w_tuple0 = W_TupleObject(self.space, [])
-        w_tuple1 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple2 = W_TupleObject(self.space, [w(5), w(3), w(99)])
-        w_tuple3 = W_TupleObject(self.space, [w(5), w(3), w(99), w(-1)])
-        w_tuple4 = W_TupleObject(self.space, [w(5), w(3), w(9), w(-1)])
+        w_tuple0 = W_TupleObject([])
+        w_tuple1 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple2 = W_TupleObject([w(5), w(3), w(99)])
+        w_tuple3 = W_TupleObject([w(5), w(3), w(99), w(-1)])
+        w_tuple4 = W_TupleObject([w(5), w(3), w(9), w(-1)])
 
         assert self.space.eq_w(self.space.le(w_tuple0, w_tuple1),
                            self.space.w_True)

Modified: pypy/dist/pypy/objspace/std/tupleobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/tupleobject.py	(original)
+++ pypy/dist/pypy/objspace/std/tupleobject.py	Sat May  6 00:05:47 2006
@@ -1,5 +1,5 @@
 from pypy.objspace.std.objspace import *
-from pypy.objspace.std.intobject import W_IntObject
+from pypy.objspace.std.inttype import wrapint
 from pypy.rpython.rarithmetic import intmask
 from pypy.objspace.std.sliceobject import W_SliceObject
 from pypy.interpreter import gateway
@@ -7,8 +7,7 @@
 class W_TupleObject(W_Object):
     from pypy.objspace.std.tupletype import tuple_typedef as typedef
     
-    def __init__(w_self, space, wrappeditems):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, wrappeditems):
         w_self.wrappeditems = wrappeditems   # a list of wrapped values
 
     def __repr__(w_self):
@@ -16,8 +15,7 @@
         reprlist = [repr(w_item) for w_item in w_self.wrappeditems]
         return "%s(%s)" % (w_self.__class__.__name__, ', '.join(reprlist))
 
-    def unwrap(w_tuple):
-        space = w_tuple.space
+    def unwrap(w_tuple, space):
         items = [space.unwrap(w_item) for w_item in w_tuple.wrappeditems] # XXX generic mixed types unwrap
         return tuple(items)
 
@@ -27,7 +25,7 @@
 
 def len__Tuple(space, w_tuple):
     result = len(w_tuple.wrappeditems)
-    return W_IntObject(space, result)
+    return wrapint(result)
 
 def getitem__Tuple_ANY(space, w_tuple, w_index):
     items = w_tuple.wrappeditems
@@ -41,13 +39,13 @@
 def getitem__Tuple_Slice(space, w_tuple, w_slice):
     items = w_tuple.wrappeditems
     length = len(items)
-    start, stop, step, slicelength = w_slice.indices4(length)
+    start, stop, step, slicelength = w_slice.indices4(space, length)
     assert slicelength >= 0
     subitems = [None] * slicelength
     for i in range(slicelength):
         subitems[i] = items[start]
         start += step
-    return W_TupleObject(space, subitems)
+    return W_TupleObject(subitems)
 
 def contains__Tuple_ANY(space, w_tuple, w_obj):
     for w_item in w_tuple.wrappeditems:
@@ -57,12 +55,12 @@
 
 def iter__Tuple(space, w_tuple):
     from pypy.objspace.std import iterobject
-    return iterobject.W_SeqIterObject(space, w_tuple)
+    return iterobject.W_SeqIterObject(w_tuple)
 
 def add__Tuple_Tuple(space, w_tuple1, w_tuple2):
     items1 = w_tuple1.wrappeditems
     items2 = w_tuple2.wrappeditems
-    return W_TupleObject(space, items1 + items2)
+    return W_TupleObject(items1 + items2)
 
 def mul_tuple_times(space, w_tuple, w_times):
     try:
@@ -72,7 +70,7 @@
             raise FailedToImplement
         raise    
     items = w_tuple.wrappeditems
-    return W_TupleObject(space, items * times)    
+    return W_TupleObject(items * times)    
 
 def mul__Tuple_ANY(space, w_tuple, w_times):
     return mul_tuple_times(space, w_tuple, w_times)
@@ -143,7 +141,7 @@
     return space.wrap(intmask(x))
 
 def getnewargs__Tuple(space, w_tuple):
-    return space.newtuple([W_TupleObject(space, w_tuple.wrappeditems)])
+    return space.newtuple([W_TupleObject(w_tuple.wrappeditems)])
 
 
 register_all(vars())

Modified: pypy/dist/pypy/objspace/std/tupletype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/tupletype.py	(original)
+++ pypy/dist/pypy/objspace/std/tupletype.py	Sat May  6 00:05:47 2006
@@ -11,7 +11,7 @@
     else:
         tuple_w = space.unpackiterable(w_sequence)
     w_obj = space.allocate_instance(W_TupleObject, w_tupletype)
-    W_TupleObject.__init__(w_obj, space, tuple_w)
+    W_TupleObject.__init__(w_obj, tuple_w)
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/typeobject.py	Sat May  6 00:05:47 2006
@@ -45,7 +45,7 @@
 
     def __init__(w_self, space, name, bases_w, dict_w,
                  overridetypedef=None):
-        W_Object.__init__(w_self, space)
+        w_self.space = space
         w_self.name = name
         w_self.bases_w = bases_w
         w_self.dict_w = dict_w
@@ -297,7 +297,7 @@
         dictspec = []
         for key, w_value in w_self.dict_w.items():
             dictspec.append((space.wrap(key), w_value))
-        return W_DictProxyObject(space, space.newdict(dictspec))
+        return W_DictProxyObject(space.newdict(dictspec))
 
     def unwrap(w_self):
         if w_self.instancetypedef.fakedcpytype is not None:

Modified: pypy/dist/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodeobject.py	Sat May  6 00:05:47 2006
@@ -9,18 +9,14 @@
 class W_UnicodeObject(W_Object):
     from pypy.objspace.std.unicodetype import unicode_typedef as typedef
 
-    def __init__(w_self, space, unicodechars):
-        W_Object.__init__(w_self, space)
+    def __init__(w_self, unicodechars):
         w_self._value = unicodechars
-        if len(unicodechars) == 0:
-            w_self.w_hash = space.wrap(0)
-        else:
-            w_self.w_hash = None
+        w_self.w_hash = None
     def __repr__(w_self):
         """ representation for debugging purposes """
         return "%s(%r)" % (w_self.__class__.__name__, w_self._value)
 
-    def unwrap(w_self):
+    def unwrap(w_self, space):
         # For faked functions taking unicodearguments.
         # Remove when we no longer need faking.
         return u''.join(w_self._value)
@@ -55,8 +51,7 @@
     return ''.join(result)
 
 # string-to-unicode delegation
-def delegate_String2Unicode(w_str):
-    space = w_str.space
+def delegate_String2Unicode(space, w_str):
     w_uni =  space.call_function(space.w_unicode, w_str)
     assert isinstance(w_uni, W_UnicodeObject) # help the annotator!
     return w_uni
@@ -97,7 +92,7 @@
     return space.wrap(ord(w_uni._value[0]))
 
 def getnewargs__Unicode(space, w_uni):
-    return space.newtuple([W_UnicodeObject(space, w_uni._value)])
+    return space.newtuple([W_UnicodeObject(w_uni._value)])
 
 def add__Unicode_Unicode(space, w_left, w_right):
     left = w_left._value
@@ -109,7 +104,7 @@
         result[i] = left[i]
     for i in range(rightlen):
         result[i + leftlen] = right[i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def add__String_Unicode(space, w_left, w_right):
     return space.add(space.call_function(space.w_unicode, w_left) , w_right)
@@ -156,7 +151,7 @@
     delim = w_self._value
     totlen = 0
     if len(list) == 0:
-        return W_UnicodeObject(space, [])
+        return W_UnicodeObject([])
     if (len(list) == 1 and
         space.is_w(space.type(list[0]), space.w_unicode)):
         return list[0]
@@ -179,7 +174,7 @@
         values_list[i] = item
     totlen += len(delim) * (len(values_list) - 1)
     if len(values_list) == 1:
-        return W_UnicodeObject(space, values_list[0])
+        return W_UnicodeObject(values_list[0])
     # Allocate result
     result = [u'\0'] * totlen
     first = values_list[0]
@@ -196,7 +191,7 @@
         for j in range(len(item)):
             result[offset + j] = item[j]
         offset += len(item)
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 
 def hash__Unicode(space, w_uni):
@@ -224,12 +219,12 @@
         exc = space.call_function(space.w_IndexError,
                                   space.wrap("unicode index out of range"))
         raise OperationError(space.w_IndexError, exc)
-    return W_UnicodeObject(space, [uni[ival]])
+    return W_UnicodeObject([uni[ival]])
 
 def getitem__Unicode_Slice(space, w_uni, w_slice):
     uni = w_uni._value
     length = len(uni)
-    start, stop, step, sl = w_slice.indices4(length)
+    start, stop, step, sl = w_slice.indices4(space, length)
     if sl == 0:
         r = []
     elif step == 1:
@@ -237,18 +232,18 @@
         r = uni[start:stop]
     else:
         r = [uni[start + i*step] for i in range(sl)]
-    return W_UnicodeObject(space, r)
+    return W_UnicodeObject(r)
 
 def mul__Unicode_ANY(space, w_uni, w_times):
     chars = w_uni._value
     charlen = len(chars)
     times = space.int_w(w_times)
     if times <= 0 or charlen == 0:
-        return W_UnicodeObject(space, [])
+        return W_UnicodeObject([])
     if times == 1:
         return space.call_function(space.w_unicode, w_uni)
     if charlen == 1:
-        return W_UnicodeObject(space, [w_uni._value[0]] * times)
+        return W_UnicodeObject([w_uni._value[0]] * times)
 
     try:
         result = [u'\0'] * (charlen * times)
@@ -258,7 +253,7 @@
         offset = i * charlen
         for j in range(charlen):
             result[offset + j] = chars[j]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def mul__ANY_Unicode(space, w_times, w_uni):
     return space.mul(w_uni, w_times)
@@ -371,7 +366,7 @@
     result = [u'\0'] * (rpos - lpos)
     for i in range(rpos - lpos):
         result[i] = u_self[lpos + i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def _strip_none(space, w_self, left, right):
     "internal function called by str_xstrip methods"
@@ -391,7 +386,7 @@
     result = [u'\0'] * (rpos - lpos)
     for i in range(rpos - lpos):
         result[i] = u_self[lpos + i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_strip__Unicode_None(space, w_self, w_chars):
     return _strip_none(space, w_self, 1, 1)
@@ -420,12 +415,12 @@
 def unicode_capitalize__Unicode(space, w_self):
     input = w_self._value
     if len(input) == 0:
-        return W_UnicodeObject(space, [])
+        return W_UnicodeObject([])
     result = [u'\0'] * len(input)
     result[0] = unichr(unicodedb.toupper(ord(input[0])))
     for i in range(1, len(input)):
         result[i] = unichr(unicodedb.tolower(ord(input[i])))
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_title__Unicode(space, w_self):
     input = w_self._value
@@ -441,21 +436,21 @@
         else:
             result[i] = unichr(unicodedb.totitle(unichar))
         previous_is_cased = unicodedb.iscased(unichar)
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_lower__Unicode(space, w_self):
     input = w_self._value
     result = [u'\0'] * len(input)
     for i in range(len(input)):
         result[i] = unichr(unicodedb.tolower(ord(input[i])))
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_upper__Unicode(space, w_self):
     input = w_self._value
     result = [u'\0'] * len(input)
     for i in range(len(input)):
         result[i] = unichr(unicodedb.toupper(ord(input[i])))
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_swapcase__Unicode(space, w_self):
     input = w_self._value
@@ -468,7 +463,7 @@
             result[i] = unichr(unicodedb.tolower(unichar))
         else:
             result[i] = input[i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def _normalize_index(length, index):
     if index < 0:
@@ -533,7 +528,7 @@
     result = [fillchar] * width
     for i in range(len(self)):
         result[leftpad + i] = self[i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_ljust__Unicode_ANY_ANY(space, w_self, w_width, w_fillchar):
     self = w_self._value
@@ -545,7 +540,7 @@
     result = [fillchar] * width
     for i in range(len(self)):
         result[i] = self[i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_rjust__Unicode_ANY_ANY(space, w_self, w_width, w_fillchar):
     self = w_self._value
@@ -557,13 +552,13 @@
     result = [fillchar] * width
     for i in range(len(self)):
         result[padding + i] = self[i]
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
     
 def unicode_zfill__Unicode_ANY(space, w_self, w_width):
     self = w_self._value
     width = space.int_w(w_width)
     if len(self) == 0:
-        return W_UnicodeObject(space, [u'0'] * width)
+        return W_UnicodeObject([u'0'] * width)
     padding = width - len(self)
     if padding <= 0:
         return space.call_function(space.w_unicode, w_self)
@@ -574,7 +569,7 @@
     if self[0] in (u'+', u'-'):
         result[0] = self[0]
         result[padding] = u'0'
-    return W_UnicodeObject(space, result)
+    return W_UnicodeObject(result)
 
 def unicode_splitlines__Unicode_ANY(space, w_self, w_keepends):
     self = w_self._value
@@ -593,18 +588,16 @@
             if (self[pos] == u'\r' and pos + 1 < end and
                 self[pos + 1] == u'\n'):
                 # Count CRLF as one linebreak
-                lines.append(W_UnicodeObject(space,
-                                             self[start:pos + keepends * 2]))
+                lines.append(W_UnicodeObject(self[start:pos + keepends * 2]))
                 pos += 1
             else:
-                lines.append(W_UnicodeObject(space,
-                                             self[start:pos + keepends]))
+                lines.append(W_UnicodeObject(self[start:pos + keepends]))
             pos += 1
             start = pos
         else:
             pos += 1
     if not unicodedb.islinebreak(ord(self[end - 1])):
-        lines.append(W_UnicodeObject(space, self[start:]))
+        lines.append(W_UnicodeObject(self[start:]))
     return space.newlist(lines)
 
 def unicode_find__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end):
@@ -678,7 +671,7 @@
         else:
             break
         if inword == 1:
-            parts.append(W_UnicodeObject(space, self[start:index]))
+            parts.append(W_UnicodeObject(self[start:index]))
             maxsplit -= 1
         # Eat whitespace
         for start in range(index + 1, end):
@@ -687,7 +680,7 @@
         else:
             return space.newlist(parts)
 
-    parts.append(W_UnicodeObject(space, self[start:]))
+    parts.append(W_UnicodeObject(self[start:]))
     return space.newlist(parts)
 
 def unicode_split__Unicode_Unicode_ANY(space, w_self, w_delim, w_maxsplit):
@@ -707,10 +700,10 @@
         index = _find(self, delim, start, end)
         if index < 0:
             break
-        parts.append(W_UnicodeObject(space, self[start:index]))
+        parts.append(W_UnicodeObject(self[start:index]))
         start = index + delim_len
         maxsplit -= 1
-    parts.append(W_UnicodeObject(space, self[start:]))
+    parts.append(W_UnicodeObject(self[start:]))
     return space.newlist(parts)
 
 
@@ -734,7 +727,7 @@
         else:
             break
         if inword == 1:
-            parts.append(W_UnicodeObject(space, self[index+1:end]))
+            parts.append(W_UnicodeObject(self[index+1:end]))
             maxsplit -= 1
         # Eat whitespace
         for end in range(index, start-1, -1):
@@ -743,7 +736,7 @@
         else:
             return space.newlist(parts)
 
-    parts.append(W_UnicodeObject(space, self[:end]))
+    parts.append(W_UnicodeObject(self[:end]))
     parts.reverse()
     return space.newlist(parts)
 
@@ -764,10 +757,10 @@
         index = _rfind(self, delim, 0, end)
         if index < 0:
             break
-        parts.append(W_UnicodeObject(space, self[index+delim_len:end]))
+        parts.append(W_UnicodeObject(self[index+delim_len:end]))
         end = index
         maxsplit -= 1
-    parts.append(W_UnicodeObject(space, self[:end]))
+    parts.append(W_UnicodeObject(self[:end]))
     parts.reverse()
     return space.newlist(parts)
 
@@ -775,18 +768,18 @@
     if len(self) == 0:
         return []
     if maxsplit == 0:
-        return [W_UnicodeObject(space, self)]
+        return [W_UnicodeObject(self)]
     index = 0
     end = len(self)
-    parts = [W_UnicodeObject(space, [])]
+    parts = [W_UnicodeObject([])]
     maxsplit -= 1
     while maxsplit != 0:
         if index >= end:
             break
-        parts.append(W_UnicodeObject(space, [self[index]]))
+        parts.append(W_UnicodeObject([self[index]]))
         index += 1
         maxsplit -= 1
-    parts.append(W_UnicodeObject(space, self[index:]))
+    parts.append(W_UnicodeObject(self[index:]))
     return parts
 
 def unicode_replace__Unicode_Unicode_Unicode_ANY(space, w_self, w_old,

Modified: pypy/dist/pypy/objspace/std/unicodetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/unicodetype.py	(original)
+++ pypy/dist/pypy/objspace/std/unicodetype.py	Sat May  6 00:05:47 2006
@@ -92,7 +92,7 @@
             # raising UnicodeDecodeError is messy, so "please crash for me"
             return unicode_from_object(space, w_str)
         codelist.append(unichr(code))
-    return W_UnicodeObject(space, codelist)
+    return W_UnicodeObject(codelist)
 
 
 def descr__new__(space, w_unicodetype, w_string=None, w_encoding=None, w_errors=None):
@@ -109,7 +109,7 @@
             return w_obj
         w_value = w_obj
     elif space.is_w(w_obj, space.w_None):
-        w_value = W_UnicodeObject(space, [])
+        w_value = W_UnicodeObject([])
     elif (space.is_w(w_encoding, space.w_None) and
           space.is_w(w_errors, space.w_None)):
         if space.is_true(space.isinstance(w_obj, space.w_str)):
@@ -123,7 +123,7 @@
     # help the annotator! also the ._value depends on W_UnicodeObject layout
     assert isinstance(w_value, W_UnicodeObject)
     w_newobj = space.allocate_instance(W_UnicodeObject, w_unicodetype)
-    W_UnicodeObject.__init__(w_newobj, space, w_value._value)
+    W_UnicodeObject.__init__(w_newobj, w_value._value)
     return w_newobj
 
 # ____________________________________________________________



More information about the Pypy-commit mailing list