[pypy-svn] r65788 - pypy/trunk/pypy/objspace/std

benjamin at codespeak.net benjamin at codespeak.net
Tue Jun 16 04:08:27 CEST 2009


Author: benjamin
Date: Tue Jun 16 04:08:25 2009
New Revision: 65788

Modified:
   pypy/trunk/pypy/objspace/std/fake.py
Log:
cleanup a little

Modified: pypy/trunk/pypy/objspace/std/fake.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/fake.py	(original)
+++ pypy/trunk/pypy/objspace/std/fake.py	Tue Jun 16 04:08:25 2009
@@ -10,11 +10,10 @@
 
 # this file automatically generates non-reimplementations of CPython
 # types that we do not yet implement in the standard object space
-# (files being the biggy)
 
 
 def fake_object(space, x):
-    if isinstance(x, file): 
+    if isinstance(x, file):
         debug_print("fake-wrapping interp file %s" % x)
     if isinstance(x, type):
         ft = fake_type(x)
@@ -61,10 +60,9 @@
 
 def really_build_fake_type(cpy_type):
     "NOT_RPYTHON (not remotely so!)."
-    #assert not issubclass(cpy_type, file), cpy_type
     debug_print('faking %r'%(cpy_type,))
     kw = {}
-    
+
     if cpy_type.__name__ == 'SRE_Pattern':
         import re
         import __builtin__
@@ -92,7 +90,7 @@
         for (key, w_value) in kwds_w.items():
             kwds[key] = space.unwrap(w_value)
         try:
-            r = apply(cpy_type.__new__, [cpy_type]+args, kwds)
+            r = cpy_type.__new__(*[cpy_type]+args, **kwds)
         except:
             wrap_exception(space)
             raise
@@ -118,11 +116,7 @@
             w_self.val = val
         def unwrap(w_self, space):
             return w_self.val
-                
-    # cannot write to W_Fake.__name__ in Python 2.2!
-    W_Fake = type(W_Object)('W_Fake%s'%(cpy_type.__name__.capitalize()),
-                            (W_Object,),
-                            dict(W_Fake.__dict__.items()))
+    W_Fake.__name__ = 'W_Fake%s'%(cpy_type.__name__.capitalize())
     W_Fake.typedef.fakedcpytype = cpy_type
     return W_Fake
 
@@ -159,7 +153,7 @@
 
     def getfastscope(self):
         raise OperationError(self.space.w_TypeError,
-          self.space.wrap("cannot get fastscope of a CPythonFakeFrame"))                           
+          self.space.wrap("cannot get fastscope of a CPythonFakeFrame"))
     def run(self):
         code = self.fakecode
         assert isinstance(code, CPythonFakeCode)



More information about the Pypy-commit mailing list