[pypy-svn] r34231 - in pypy/branch/transparent-proxy/pypy: config objspace/std objspace/std/test

pedronis at codespeak.net pedronis at codespeak.net
Sun Nov 5 13:12:16 CET 2006


Author: pedronis
Date: Sun Nov  5 13:12:14 2006
New Revision: 34231

Modified:
   pypy/branch/transparent-proxy/pypy/config/pypyoption.py
   pypy/branch/transparent-proxy/pypy/objspace/std/model.py
   pypy/branch/transparent-proxy/pypy/objspace/std/objspace.py
   pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy.py
   pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_function.py
   pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_internals.py
Log:
adding a --objspace-std-withtproxy option to enable/disable transparent proxy support.



Modified: pypy/branch/transparent-proxy/pypy/config/pypyoption.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/config/pypyoption.py	(original)
+++ pypy/branch/transparent-proxy/pypy/config/pypyoption.py	Sun Nov  5 13:12:14 2006
@@ -58,6 +58,9 @@
                    default=False),
        
         OptionDescription("std", "Standard Object Space Options", [
+            BoolOption("withtproxy", "support transparent proxies",
+                       default=False),
+
             BoolOption("withsmallint", "use tagged integers",
                        default=False),
 

Modified: pypy/branch/transparent-proxy/pypy/objspace/std/model.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/objspace/std/model.py	(original)
+++ pypy/branch/transparent-proxy/pypy/objspace/std/model.py	Sun Nov  5 13:12:14 2006
@@ -18,6 +18,8 @@
                         "dictmultiobject.W_DictMultiIterObject"],
     "withrangelist"  : ["rangeobject.W_RangeListObject",
                         "rangeobject.W_RangeIterObject"],
+    "withtproxy" : ["proxyobject.W_TransparentList",
+                    "proxyobject.W_TransparentDict"],
 }
 
 class StdTypeModel:
@@ -66,7 +68,6 @@
         from pypy.objspace.std import stringobject
         from pypy.objspace.std import strsliceobject
         from pypy.objspace.std import strjoinobject
-        from pypy.objspace.std import proxyobject
         from pypy.objspace.std import typeobject
         from pypy.objspace.std import sliceobject
         from pypy.objspace.std import longobject
@@ -75,6 +76,7 @@
         from pypy.objspace.std import unicodeobject
         from pypy.objspace.std import dictproxyobject
         from pypy.objspace.std import rangeobject
+        from pypy.objspace.std import proxyobject
         from pypy.objspace.std import fake
         import pypy.objspace.std.default # register a few catch-all multimethods
 
@@ -120,10 +122,6 @@
                     else:
                         imported_but_not_registered[implcls] = True
 
-        # xxx config
-        self.typeorder[proxyobject.W_TransparentList] = []
-        self.typeorder[proxyobject.W_TransparentDict] = []
-
         if config.objspace.std.withstrdict:
             del self.typeorder[dictobject.W_DictObject]
             del self.typeorder[dictobject.W_DictIterObject]

Modified: pypy/branch/transparent-proxy/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/objspace/std/objspace.py	(original)
+++ pypy/branch/transparent-proxy/pypy/objspace/std/objspace.py	Sun Nov  5 13:12:14 2006
@@ -136,10 +136,11 @@
         # final setup
         self.setup_builtin_modules()
         # Adding transparent proxy call
-        from pypy.objspace.std.transparent import app_proxy
+        if self.config.objspace.std.withtproxy:
+             from pypy.objspace.std.transparent import app_proxy
         
-        self.setitem(self.builtin.w_dict, self.wrap('proxy'),
-                  self.wrap(app_proxy))
+             self.setitem(self.builtin.w_dict, self.wrap('proxy'),
+                          self.wrap(app_proxy))
 
     def enable_old_style_classes_as_default_metaclass(self):
         self.setitem(self.builtin.w_dict, self.wrap('__metaclass__'), self.w_classobj)

Modified: pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy.py	(original)
+++ pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy.py	Sun Nov  5 13:12:14 2006
@@ -5,6 +5,9 @@
 from pypy.conftest import gettestobjspace
 
 class AppProxyBasic(object):
+    def setup_class(cls):
+        cls.space = gettestobjspace(**{"objspace.std.withtproxy": True})
+        
     def setup_method(self, meth):
         self.w_Controller = self.space.appexec([], """():
         class Controller(object):
@@ -101,4 +104,5 @@
 
 class AppTestDictStrProxy(AppTestDictProxy):
     def setup_class(cls):
-        cls.space = gettestobjspace(**{"objspace.std.withstrdict": True})
+        cls.space = gettestobjspace(**{"objspace.std.withstrdict": True,
+                                       "objspace.std.withtproxy": True})

Modified: pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_function.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_function.py	(original)
+++ pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_function.py	Sun Nov  5 13:12:14 2006
@@ -2,9 +2,13 @@
 """ test proxy on functions and other crazy goodies
 """
 
+from pypy.conftest import gettestobjspace
 from pypy.objspace.std.test.test_proxy import AppProxyBasic
 
 class AppTestProxyFunction(object):
+    def setup_class(cls):
+        cls.space = gettestobjspace(**{"objspace.std.withtproxy": True})
+
     def setup_method(self, meth):
         self.w_get_proxy = self.space.appexec([], """():
         class Controller(object):

Modified: pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_internals.py
==============================================================================
--- pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_internals.py	(original)
+++ pypy/branch/transparent-proxy/pypy/objspace/std/test/test_proxy_internals.py	Sun Nov  5 13:12:14 2006
@@ -1,8 +1,12 @@
 
 """ test proxy internals like code, traceback, frame
 """
+from pypy.conftest import gettestobjspace
 
 class AppProxy(object):
+    def setup_class(cls):
+        cls.space = gettestobjspace(**{"objspace.std.withtproxy": True})
+
     def setup_method(self, meth):
         self.w_get_proxy = self.space.appexec([], """():
         class Controller(object):
@@ -47,7 +51,7 @@
         fp = self.get_proxy(frame)
         assert fp.f_locals == frame.f_locals
 
-class AppTestProxyTracebackController(object):
+class AppTestProxyTracebackController(AppProxy):
     def test_controller(self):
         import types
         import sys



More information about the Pypy-commit mailing list