[pypy-svn] r36562 - pypy/dist/pypy/objspace/std

fijal at codespeak.net fijal at codespeak.net
Fri Jan 12 13:40:23 CET 2007


Author: fijal
Date: Fri Jan 12 13:40:21 2007
New Revision: 36562

Modified:
   pypy/dist/pypy/objspace/std/proxyobject.py
   pypy/dist/pypy/objspace/std/transparent.py
Log:
Add W_TransparentCode


Modified: pypy/dist/pypy/objspace/std/proxyobject.py
==============================================================================
--- pypy/dist/pypy/objspace/std/proxyobject.py	(original)
+++ pypy/dist/pypy/objspace/std/proxyobject.py	Fri Jan 12 13:40:21 2007
@@ -68,7 +68,14 @@
         def setdict(self, space, w_dict):
             if not self.setdictvalue(space, space.wrap('__dict__'), w_dict):
                 baseobjspace.W_Root.setdict(self, space, w_dict)
-    
+        
+##        def __getattr__(self, attr):
+##            # NOT_RPYTHON
+##            try:
+##                return self.getdictvalue(self.space, self.space.wrap(attr))
+##            except OperationError, e:
+##                raise AttributeError(attr)
+        
     W_Transparent.__name__ = name
     return W_Transparent
 
@@ -78,7 +85,8 @@
 from pypy.objspace.std.objecttype import object_typedef
 W_TransparentObject.typedef = object_typedef
 
-from pypy.interpreter.typedef import Function, GeneratorIterator, PyTraceback, PyFrame
+from pypy.interpreter.typedef import Function, GeneratorIterator, PyTraceback, \
+    PyFrame, PyCode
 
 class W_TransparentFunction(W_Transparent):
     typedef = Function.typedef
@@ -86,6 +94,9 @@
 class W_TransparentTraceback(W_Transparent):
     typedef = PyTraceback.typedef
 
+class W_TransparentCode(W_Transparent):
+    typedef = PyCode.typedef
+
 class W_TransparentFrame(W_Transparent):
     typedef = PyFrame.typedef
 

Modified: pypy/dist/pypy/objspace/std/transparent.py
==============================================================================
--- pypy/dist/pypy/objspace/std/transparent.py	(original)
+++ pypy/dist/pypy/objspace/std/transparent.py	Fri Jan 12 13:40:21 2007
@@ -9,7 +9,8 @@
 from pypy.objspace.std.typeobject import W_TypeObject
 
 def proxy(space, w_type, w_controller):
-    from pypy.interpreter.typedef import Function, PyTraceback, PyFrame, GeneratorIterator
+    from pypy.interpreter.typedef import Function, PyTraceback, PyFrame, \
+        PyCode, GeneratorIterator
     
     if not space.is_true(space.callable(w_controller)):
         raise OperationError(space.w_TypeError, space.wrap("controller should be function"))
@@ -27,6 +28,8 @@
             return W_TransparentFrame(space, w_type, w_controller)
         if space.is_true(space.issubtype(w_type, space.gettypeobject(GeneratorIterator.typedef))):
             return W_TransparentGenerator(space, w_type, w_controller)
+        if space.is_true(space.issubtype(w_type, space.gettypeobject(PyCode.typedef))):
+            return W_TransparentCode(space, w_type, w_controller)
         if w_type.instancetypedef is space.w_object.instancetypedef:
             return W_Transparent(space, w_type, w_controller)
     else:



More information about the Pypy-commit mailing list