[pypy-svn] r59040 - in pypy/dist/pypy/translator/backendopt: . test

arigo at codespeak.net arigo at codespeak.net
Sun Oct 12 18:43:36 CEST 2008


Author: arigo
Date: Sun Oct 12 18:43:35 2008
New Revision: 59040

Modified:
   pypy/dist/pypy/translator/backendopt/mallocv.py
   pypy/dist/pypy/translator/backendopt/test/test_mallocv.py
Log:
(pedronis, arigo)
Make the test pass.  Exceptions are kind of working now :-)


Modified: pypy/dist/pypy/translator/backendopt/mallocv.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/mallocv.py	(original)
+++ pypy/dist/pypy/translator/backendopt/mallocv.py	Sun Oct 12 18:43:35 2008
@@ -450,8 +450,19 @@
             if excdata.fn_exception_match(exc_type, catchlink.llexitcase):
                 # Match found.  Follow this link.
                 mynodes = catchingframe.get_nodes_in_use()
-                # XXX Constants
-                nodelist = [mynodes[v] for v in catchlink.args]
+                for node, attr in zip(nodelist,
+                                      ['last_exception', 'last_exc_value']):
+                    v = getattr(catchlink, attr)
+                    if isinstance(v, Variable):
+                        mynodes[v] = node
+                #
+                nodelist = []
+                for v in catchlink.args:
+                    if isinstance(v, Variable):
+                        node = mynodes[v]
+                    else:
+                        node = getconstnode(v, renamings)
+                    nodelist.append(node)
                 return self.create_outgoing_link(catchingframe,
                                                  catchlink.target,
                                                  nodelist, renamings)
@@ -589,9 +600,7 @@
         if isinstance(v, Variable):
             return self.nodes[v]
         else:
-            rtnode = RuntimeSpecNode(None, v.concretetype)
-            self.renamings[rtnode] = v
-            return rtnode
+            return getconstnode(v, self.renamings)
 
     def rename_nonvirtual(self, v, where=None):
         if not isinstance(v, Variable):
@@ -906,3 +915,8 @@
         log.WARNING('  %s: %s' % (e.__class__.__name__, e))
     else:
         return (result,)
+
+def getconstnode(v, renamings):
+    rtnode = RuntimeSpecNode(None, v.concretetype)
+    renamings[rtnode] = v
+    return rtnode

Modified: pypy/dist/pypy/translator/backendopt/test/test_mallocv.py
==============================================================================
--- pypy/dist/pypy/translator/backendopt/test/test_mallocv.py	(original)
+++ pypy/dist/pypy/translator/backendopt/test/test_mallocv.py	Sun Oct 12 18:43:35 2008
@@ -294,7 +294,6 @@
                            expected_calls=0)     # inlined
 
     def test_call_raise_catch_inspect(self):
-        py.test.skip("in-progress")
         class A:
             pass
         class E(Exception):



More information about the Pypy-commit mailing list