[pypy-svn] r12035 - in pypy/dist/pypy: interpreter objspace/std

arigo at codespeak.net arigo at codespeak.net
Sat May 7 00:12:16 CEST 2005


Author: arigo
Date: Sat May  7 00:12:16 2005
New Revision: 12035

Modified:
   pypy/dist/pypy/interpreter/function.py
   pypy/dist/pypy/interpreter/pycode.py
   pypy/dist/pypy/objspace/std/dicttype.py
   pypy/dist/pypy/objspace/std/fake.py
   pypy/dist/pypy/objspace/std/floattype.py
   pypy/dist/pypy/objspace/std/inttype.py
   pypy/dist/pypy/objspace/std/listtype.py
   pypy/dist/pypy/objspace/std/longtype.py
   pypy/dist/pypy/objspace/std/objecttype.py
   pypy/dist/pypy/objspace/std/slicetype.py
   pypy/dist/pypy/objspace/std/stringtype.py
   pypy/dist/pypy/objspace/std/tupletype.py
   pypy/dist/pypy/objspace/std/typetype.py
Log:
Replace the calls to xyz.__init__() with known calls to
XyzClass.__init__(xyz).  Avoids annotator surprizes.



Modified: pypy/dist/pypy/interpreter/function.py
==============================================================================
--- pypy/dist/pypy/interpreter/function.py	(original)
+++ pypy/dist/pypy/interpreter/function.py	Sat May  7 00:12:16 2005
@@ -181,10 +181,10 @@
         self.w_class = w_class         # possibly space.w_None
         
     def descr_method__new__(space, w_subtype, w_function, w_instance, w_class=None):
-        method = space.allocate_instance(Method, w_subtype)
         if space.is_w( w_instance, space.w_None ):
             w_instance = None
-        method.__init__(space, w_function, w_instance, w_class)
+        method = space.allocate_instance(Method, w_subtype)
+        Method.__init__(method, space, w_function, w_instance, w_class)
         return space.wrap(method)
 
     def __repr__(self):
@@ -285,7 +285,7 @@
             raise OperationError(space.w_TypeError,
                                  space.wrap("expected a function object"))
         bltin = space.allocate_instance(BuiltinFunction, w_subtype)
-        bltin.__init__(func)
+        BuiltinFunction.__init__(bltin, func)
         return space.wrap(bltin)
 
     def descr_function_repr(self):

Modified: pypy/dist/pypy/interpreter/pycode.py
==============================================================================
--- pypy/dist/pypy/interpreter/pycode.py	(original)
+++ pypy/dist/pypy/interpreter/pycode.py	Sat May  7 00:12:16 2005
@@ -239,7 +239,7 @@
                           lnotab, w_freevars=NoneNotWrapped,
                           w_cellvars=NoneNotWrapped):
         code = space.allocate_instance(PyCode, w_subtype)
-        code.__init__(space)
+        PyCode.__init__(code, space)
         code.co_argcount   = argcount 
         code.co_nlocals    = nlocals 
         code.co_stacksize  = stacksize 

Modified: pypy/dist/pypy/objspace/std/dicttype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/dicttype.py	(original)
+++ pypy/dist/pypy/objspace/std/dicttype.py	Sat May  7 00:12:16 2005
@@ -90,7 +90,7 @@
 def descr__new__(space, w_dicttype, __args__):
     from pypy.objspace.std.dictobject import W_DictObject
     w_obj = space.allocate_instance(W_DictObject, w_dicttype)
-    w_obj.__init__(space, [])
+    W_DictObject.__init__(w_obj, space, [])
     return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -86,7 +86,7 @@
             wrap_exception(space)
             raise
         w_obj = space.allocate_instance(W_Fake, w_type)
-        w_obj.__init__(space, r)
+        W_Fake.__init__(w_obj, space, r)
         return w_obj
 
     kw['__new__'] = gateway.interp2app(fake__new__,

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  7 00:12:16 2005
@@ -16,7 +16,7 @@
                           # whatever x.__float__() returned
         value = space.float_w(w_obj)
     w_obj = space.allocate_instance(W_FloatObject, w_floattype)
-    w_obj.__init__(space, value)
+    W_FloatObject.__init__(w_obj, space, value)
     return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -72,7 +72,7 @@
         return w_longval
     else:
         w_obj = space.allocate_instance(W_IntObject, w_inttype)
-        w_obj.__init__(space, value)
+        W_IntObject.__init__(w_obj, space, value)
         return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -31,7 +31,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_obj.__init__(space, [])
+    W_ListObject.__init__(w_obj, space, [])
     return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -58,7 +58,7 @@
                                  space.wrap(e.msg))
 
     w_obj = space.allocate_instance(W_LongObject, w_longtype)
-    w_obj.__init__(space, w_value.digits, w_value.sign)
+    W_LongObject.__init__(w_obj, space, w_value.digits, w_value.sign)
     return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -31,7 +31,7 @@
                                  space.wrap("default __new__ takes "
                                             "no parameters"))
     w_obj = space.allocate_instance(W_ObjectObject, w_type)
-    w_obj.__init__(space)
+    W_ObjectObject.__init__(w_obj, space)
     return w_obj
 
 def descr__hash__(space, w_obj):

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  7 00:12:16 2005
@@ -117,7 +117,7 @@
         raise OperationError(space.w_TypeError,
                              space.wrap("slice() takes at least 1 argument"))
     w_obj = space.allocate_instance(W_SliceObject, w_slicetype)
-    w_obj.__init__(space, w_start, w_stop, w_step)
+    W_SliceObject.__init__(w_obj, space, w_start, w_stop, w_step)
     return w_obj
 #
 descr__new__.unwrap_spec = [baseobjspace.ObjSpace, baseobjspace.W_Root,

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  7 00:12:16 2005
@@ -46,7 +46,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_obj.__init__(space, value)
+    W_StringObject.__init__(w_obj, space, value)
     return w_obj
 
 # ____________________________________________________________

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  7 00:12:16 2005
@@ -11,7 +11,7 @@
     else:
         tuple_w = space.unpackiterable(w_items)
     w_obj = space.allocate_instance(W_TupleObject, w_tupletype)
-    w_obj.__init__(space, tuple_w)
+    W_TupleObject.__init__(w_obj, space, tuple_w)
     return w_obj
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/dist/pypy/objspace/std/typetype.py	(original)
+++ pypy/dist/pypy/objspace/std/typetype.py	Sat May  7 00:12:16 2005
@@ -41,7 +41,8 @@
         key = space.str_w(w_key)
         dict_w[key] = space.getitem(w_dict, w_key)
     w_type = space.allocate_instance(W_TypeObject, w_typetype)
-    w_type.__init__(space, name, bases_w or [space.w_object], dict_w)
+    W_TypeObject.__init__(w_type, space, name, bases_w or [space.w_object],
+                          dict_w)
     return w_type
 
 def _precheck_for_new(space, w_type):



More information about the Pypy-commit mailing list