[pypy-svn] r56128 - in pypy/branch/less-meta-instances/pypy/translator/cli: . test

antocuni at codespeak.net antocuni at codespeak.net
Fri Jun 27 18:33:47 CEST 2008


Author: antocuni
Date: Fri Jun 27 18:33:47 2008
New Revision: 56128

Modified:
   pypy/branch/less-meta-instances/pypy/translator/cli/function.py
   pypy/branch/less-meta-instances/pypy/translator/cli/test/runtest.py
   pypy/branch/less-meta-instances/pypy/translator/cli/test/test_exception.py
Log:
because of backendopts, the various try/finally/except clauses were
inlined, so the tests were not testing anything.  Disable backendopts
for them, and fix a bug




Modified: pypy/branch/less-meta-instances/pypy/translator/cli/function.py
==============================================================================
--- pypy/branch/less-meta-instances/pypy/translator/cli/function.py	(original)
+++ pypy/branch/less-meta-instances/pypy/translator/cli/function.py	Fri Jun 27 18:33:47 2008
@@ -129,10 +129,10 @@
         else:
             # the exception value is on the stack, store it in the proper place
             if isinstance(link.last_exception, flowmodel.Variable):
-                #self.ilasm.opcode('dup')
+                self.ilasm.opcode('dup')
                 self.store(link.last_exc_value)
-                #self.ilasm.get_field(('class Object_meta', 'Object', 'meta'))
-                #self.store(link.last_exception)
+                self.ilasm.call_method('[mscorlib]System.Type object::GetType()', virtual=True)
+                self.store(link.last_exception)
             else:
                 self.store(link.last_exc_value)
             self._setup_link(link)

Modified: pypy/branch/less-meta-instances/pypy/translator/cli/test/runtest.py
==============================================================================
--- pypy/branch/less-meta-instances/pypy/translator/cli/test/runtest.py	(original)
+++ pypy/branch/less-meta-instances/pypy/translator/cli/test/runtest.py	Fri Jun 27 18:33:47 2008
@@ -277,15 +277,22 @@
     def _skip_llinterpreter(self, reason, skipLL=True, skipOO=True):
         pass
 
-    def interpret(self, fn, args, annotation=None, backendopt=True, exctrans=False):
+    def _get_backendopt(self, backendopt):
+        if backendopt is None:
+            backendopt = getattr(self, 'backendopt', True) # enable it by default
+        return backendopt
+    
+    def interpret(self, fn, args, annotation=None, backendopt=None, exctrans=False):
+        backendopt = self._get_backendopt(backendopt)
         f = self._compile(fn, args, annotation, backendopt=backendopt, exctrans=exctrans)
         res = f(*args)
         if isinstance(res, ExceptionWrapper):
             raise res
         return res
 
-    def interpret_raises(self, exception, fn, args, backendopt=True, exctrans=False):
+    def interpret_raises(self, exception, fn, args, backendopt=None, exctrans=False):
         import exceptions # needed by eval
+        backendopt = self._get_backendopt(backendopt)
         try:
             self.interpret(fn, args, backendopt=backendopt, exctrans=exctrans)
         except ExceptionWrapper, ex:

Modified: pypy/branch/less-meta-instances/pypy/translator/cli/test/test_exception.py
==============================================================================
--- pypy/branch/less-meta-instances/pypy/translator/cli/test/test_exception.py	(original)
+++ pypy/branch/less-meta-instances/pypy/translator/cli/test/test_exception.py	Fri Jun 27 18:33:47 2008
@@ -4,6 +4,7 @@
 
 class TestCliException(CliTest, BaseTestException):
     use_exception_transformer = False
+    backendopt = False
 
     def interpret(self, *args, **kwds):
         kwds['exctrans'] = self.use_exception_transformer
@@ -18,3 +19,4 @@
 
 class TestCliExceptionTransformer(TestCliException):
     use_exception_transformer = True
+    backendopt = False



More information about the Pypy-commit mailing list